/** * Load helpers only if serialization is disabled. * * @return void */ public function loadHelpers() { if (empty($this->viewVars['_serialize'])) { parent::loadHelpers(); } }
/** * Skip loading helpers if this is a _serialize based view. * * @return void */ public function loadHelpers() { if (isset($this->viewVars['_serialize'])) { return; } parent::loadHelpers(); }
/** * 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.'); }
/** * 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']); }
/** * 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; }