File indexing completed on 2024-12-22 05:36:37
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_Dojo 0017 * @subpackage Form 0018 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0019 * @license http://framework.zend.com/license/new-bsd New BSD License 0020 */ 0021 0022 /** Zend_Form_SubForm */ 0023 // require_once 'Zend/Form/SubForm.php'; 0024 0025 /** 0026 * Dijit-enabled SubForm 0027 * 0028 * @uses Zend_Form_SubForm 0029 * @package Zend_Dojo 0030 * @subpackage Form 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 * @version $Id$ 0034 */ 0035 class Zend_Dojo_Form_SubForm extends Zend_Form_SubForm 0036 { 0037 /** 0038 * Has the dojo view helper path been registered? 0039 * @var bool 0040 */ 0041 protected $_dojoViewPathRegistered = false; 0042 0043 /** 0044 * Constructor 0045 * 0046 * @param array|Zend_Config|null $options 0047 * @return void 0048 */ 0049 public function __construct($options = null) 0050 { 0051 $this->addPrefixPath('Zend_Dojo_Form_Decorator', 'Zend/Dojo/Form/Decorator', 'decorator') 0052 ->addPrefixPath('Zend_Dojo_Form_Element', 'Zend/Dojo/Form/Element', 'element') 0053 ->addElementPrefixPath('Zend_Dojo_Form_Decorator', 'Zend/Dojo/Form/Decorator', 'decorator') 0054 ->addDisplayGroupPrefixPath('Zend_Dojo_Form_Decorator', 'Zend/Dojo/Form/Decorator') 0055 ->setDefaultDisplayGroupClass('Zend_Dojo_Form_DisplayGroup'); 0056 parent::__construct($options); 0057 } 0058 0059 /** 0060 * Load the default decorators 0061 * 0062 * @return void 0063 */ 0064 public function loadDefaultDecorators() 0065 { 0066 if ($this->loadDefaultDecoratorsIsDisabled()) { 0067 return; 0068 } 0069 0070 $decorators = $this->getDecorators(); 0071 if (empty($decorators)) { 0072 $this->addDecorator('FormElements') 0073 ->addDecorator('HtmlTag', array('tag' => 'dl')) 0074 ->addDecorator('ContentPane'); 0075 } 0076 } 0077 0078 /** 0079 * Get view 0080 * 0081 * @return Zend_View_Interface 0082 */ 0083 public function getView() 0084 { 0085 $view = parent::getView(); 0086 if (!$this->_dojoViewPathRegistered) { 0087 if (false === $view->getPluginLoader('helper')->getPaths('Zend_Dojo_View_Helper')) { 0088 $view->addHelperPath('Zend/Dojo/View/Helper', 'Zend_Dojo_View_Helper'); 0089 } 0090 $this->_dojoViewPathRegistered = true; 0091 } 0092 return $view; 0093 } 0094 }