예제 #1
0
 /**
  * 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);
     }
 }
예제 #2
0
파일: LayoutTest.php 프로젝트: hjr3/zf2
 /**
  * @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());
 }
예제 #3
0
 /**
  * @return void
  */
 public function testLayoutAccessorsModifyAndRetrieveLayoutValue()
 {
     $layout = new Zend_Layout();
     $layout->setLayout('foo');
     $this->assertEquals('foo', $layout->getLayout());
 }