本文整理汇总了PHP中Cake\View\View::addHelper方法的典型用法代码示例。如果您正苦于以下问题:PHP View::addHelper方法的具体用法?PHP View::addHelper怎么用?PHP View::addHelper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\View\View
的用法示例。
在下文中一共展示了View::addHelper方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __get
/**
* Lazy loads helpers.
*
* @param string $name Name of the property being accessed.
* @return mixed Helper or property found at $name
* @deprecated Accessing request properties through this method is deprecated and will be removed in 3.0.
*/
public function __get($name)
{
if (isset($this->_helperMap[$name]) && !isset($this->{$name})) {
$settings = array_merge((array) $this->_helperMap[$name]['config'], array('enabled' => false));
$this->{$name} = $this->_View->addHelper($this->_helperMap[$name]['class'], $this->_config);
}
if (isset($this->{$name})) {
return $this->{$name};
}
}
示例2: testMagicGetAndAddHelper
/**
* Test __get allowing access to helpers.
*
* @return void
*/
public function testMagicGetAndAddHelper()
{
$View = new View();
$View->addHelper('Html');
$this->assertInstanceOf('Cake\\View\\Helper\\HtmlHelper', $View->Html);
}