本文整理汇总了PHP中Cake\View\View::loadHelper方法的典型用法代码示例。如果您正苦于以下问题:PHP View::loadHelper方法的具体用法?PHP View::loadHelper怎么用?PHP View::loadHelper使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\View\View
的用法示例。
在下文中一共展示了View::loadHelper方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _testEnabled
private function _testEnabled($method = 'GET')
{
$request = new Request();
$request->env('REQUEST_METHOD', $method);
$request->here = '/pages/home';
$response = new Response();
$View = new View($request, $response);
$View->loadHelper('ViewMemcached.ViewMemcached', ['cacheConfig' => TEST_CACHE_CONFIG]);
$View->viewPath = 'Pages';
$View->set('test', 'value');
$View->render('home', 'default');
return $View->ViewMemcached->enabled();
}
示例2: _getView
/**
* Prepares a View instance with which the given view file
* will be rendered.
*
* @return View
*/
protected function _getView()
{
$view = new View();
foreach ($this->config('helpers') as $helper) {
$view->loadHelper($helper);
}
return $view;
}
示例3: __get
/**
* Lazy loads helpers.
*
* @param string $name Name of the property being accessed.
* @return \Cake\View\Helper|null Helper instance if helper with provided name exists
*/
public function __get($name)
{
if (isset($this->_helperMap[$name]) && !isset($this->{$name})) {
$config = ['enabled' => false] + (array) $this->_helperMap[$name]['config'];
$this->{$name} = $this->_View->loadHelper($this->_helperMap[$name]['class'], $config);
return $this->{$name};
}
}
示例4: testLoadHelperDuplicate
/**
* Test loading helper when duplicate.
*
* @return void
*/
public function testLoadHelperDuplicate()
{
$View = new View();
$this->assertNotEmpty($View->loadHelper('Html', ['foo' => 'bar']));
try {
$View->loadHelper('Html', ['test' => 'value']);
$this->fail('No exception');
} catch (\RuntimeException $e) {
$this->assertContains('The "Html" alias has already been loaded', $e->getMessage());
}
}
示例5: _loadHelper
/**
* Load view helpers by configure.
*
* @param View $view
* @return void
*/
protected static function _loadHelper(View $view)
{
$hooks = self::_getConfigData(Hook::HOOK_CONFIG_HELPER_KEY);
foreach ($hooks as $helperName => $params) {
list($controllers, $config) = self::_createParams($params);
if (self::_inController($controllers, $view->request->param('controller'))) {
$view->loadHelper($helperName, $config);
}
}
}
示例6: baseHelpers
/**
* Load base helpers.
*
* @param View $view
*/
public static function baseHelpers(View $view)
{
$view->loadHelper('Html', ['className' => 'Union/Core.Html']);
$view->loadHelper('Union/Core.Document');
$view->loadHelper('Url', ['className' => 'Union/Core.Url']);
$view->loadHelper('Form', ['className' => 'Union/Core.Form', 'widgets' => ['_default' => ['Union\\Core\\View\\Widget\\BasicWidget']]]);
$view->loadHelper('Paginator', ['templates' => 'Union/Core.paginate_tpl']);
$view->loadHelper('Union/Core.Less');
$view->loadHelper('Union/Core.Union');
$view->loadHelper('Union/Core.Assets');
$view->loadHelper('Union/Core.ToolBar');
$view->loadHelper('Union/Core.XmlForm');
if ($view->request->param('prefix') == 'admin') {
$view->loadHelper('Union/Core.Ace');
$view->loadHelper('Union/Core.Admin');
$view->helpers()->get('Paginator')->config(['templates' => 'Union/Core.paginate_tpl_admin']);
}
}