/** * Switch layout based on the given condition * * @param string $ruleName */ protected function _switchLayout($ruleName) { if (!$this->_layout) { $layout = Zend_Layout::getMvcInstance(); if (!$layout) { $layout = Zend_Layout::startMvc(); } $this->_layout = $layout; } if (!$this->_defaultLayout) { $this->_defaultLayout = $this->_layout->getLayout(); } if (array_key_exists($ruleName, $this->_layouts)) { $this->_layout->setLayout($this->_layouts[$ruleName]); } else { $this->_layout->setLayout($this->_defaultLayout); } }
/** * @group ZF-5891 */ public function testSetLayoutWithDisabledFlag() { $layout = new Zend_Layout(); $layout->disableLayout(); $layout->setLayout('foo', false); $this->assertEquals('foo', $layout->getLayout()); $this->assertFalse($layout->isEnabled()); }
/** * @return void */ public function testLayoutAccessorsModifyAndRetrieveLayoutValue() { $layout = new Zend_Layout(); $layout->setLayout('foo'); $this->assertEquals('foo', $layout->getLayout()); }