本文整理汇总了PHP中Cake\View\View::loadHelpers方法的典型用法代码示例。如果您正苦于以下问题:PHP View::loadHelpers方法的具体用法?PHP View::loadHelpers怎么用?PHP View::loadHelpers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\View\View
的用法示例。
在下文中一共展示了View::loadHelpers方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadHelpers
/**
* Load helpers only if serialization is disabled.
*
* @return void
*/
public function loadHelpers()
{
if (empty($this->viewVars['_serialize'])) {
parent::loadHelpers();
}
}
示例2: loadHelpers
/**
* Skip loading helpers if this is a _serialize based view.
*
* @return void
*/
public function loadHelpers()
{
if (isset($this->viewVars['_serialize'])) {
return;
}
parent::loadHelpers();
}
示例3: testLoadHelpers
/**
* Test loadHelpers method
*
* @return void
*/
public function testLoadHelpers()
{
$View = new View();
$View->helpers = array('Html', 'Form');
$View->loadHelpers();
$this->assertInstanceOf('Cake\\View\\Helper\\HtmlHelper', $View->Html, 'Object type is wrong.');
$this->assertInstanceOf('Cake\\View\\Helper\\FormHelper', $View->Form, 'Object type is wrong.');
}
示例4: testLoadHelpers
/**
* Test loadHelpers method
*
* @return void
*/
public function testLoadHelpers()
{
$View = new View();
$View->helpers = ['Html' => ['foo' => 'bar'], 'Form' => ['foo' => 'baz']];
$View->loadHelpers();
$this->assertInstanceOf('Cake\\View\\Helper\\HtmlHelper', $View->Html, 'Object type is wrong.');
$this->assertInstanceOf('Cake\\View\\Helper\\FormHelper', $View->Form, 'Object type is wrong.');
$config = $View->Html->config();
$this->assertEquals('bar', $config['foo']);
$config = $View->Form->config();
$this->assertEquals('baz', $config['foo']);
}
示例5: _getView
/**
* MaintenanceFilter::_getView()
*
* @return \Cake\View\View
*/
protected function _getView()
{
$helpers = (array) Configure::read('Maintenance.helpers');
$View = new View(null);
$View->viewVars = (array) Configure::read('Maintenance.viewVars');
$View->helpers = $helpers;
$View->loadHelpers();
$View->hasRendered = false;
$View->viewPath = 'Maintenance';
return $View;
}