File indexing completed on 2024-12-22 05:37:13
0001 <?php 0002 /** 0003 * Zend Framework 0004 * 0005 * LICENSE 0006 * 0007 * This source file is subject to the new BSD license that is bundled 0008 * with this package in the file LICENSE.txt. 0009 * It is also available through the world-wide-web at this URL: 0010 * http://framework.zend.com/license/new-bsd 0011 * If you did not receive a copy of the license and are unable to 0012 * obtain it through the world-wide-web, please send an email 0013 * to license@zend.com so we can send you a copy immediately. 0014 * 0015 * @category Zend 0016 * @package Zend_View 0017 * @subpackage Helper 0018 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0019 * @version $Id$ 0020 * @license http://framework.zend.com/license/new-bsd New BSD License 0021 */ 0022 0023 /** Zend_View_Helper_Abstract.php */ 0024 // require_once 'Zend/View/Helper/Abstract.php'; 0025 0026 /** 0027 * View helper for retrieving layout object 0028 * 0029 * @package Zend_View 0030 * @subpackage Helper 0031 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0032 * @license http://framework.zend.com/license/new-bsd New BSD License 0033 */ 0034 class Zend_View_Helper_Layout extends Zend_View_Helper_Abstract 0035 { 0036 /** @var Zend_Layout */ 0037 protected $_layout; 0038 0039 /** 0040 * Get layout object 0041 * 0042 * @return Zend_Layout 0043 */ 0044 public function getLayout() 0045 { 0046 if (null === $this->_layout) { 0047 // require_once 'Zend/Layout.php'; 0048 $this->_layout = Zend_Layout::getMvcInstance(); 0049 if (null === $this->_layout) { 0050 // Implicitly creates layout object 0051 $this->_layout = new Zend_Layout(); 0052 } 0053 } 0054 0055 return $this->_layout; 0056 } 0057 0058 /** 0059 * Set layout object 0060 * 0061 * @param Zend_Layout $layout 0062 * @return Zend_Layout_Controller_Action_Helper_Layout 0063 */ 0064 public function setLayout(Zend_Layout $layout) 0065 { 0066 $this->_layout = $layout; 0067 return $this; 0068 } 0069 0070 /** 0071 * Return layout object 0072 * 0073 * Usage: $this->layout()->setLayout('alternate'); 0074 * 0075 * @return Zend_Layout 0076 */ 0077 public function layout() 0078 { 0079 return $this->getLayout(); 0080 } 0081 }