~chroot64bit/zivios/gentoo-experimental

« back to all changes in this revision

Viewing changes to application/library/Zend/Dojo/Form/SubForm.php

  • Committer: Mustafa A. Hashmi
  • Date: 2008-12-04 13:32:21 UTC
  • Revision ID: mhashmi@zivios.org-20081204133221-0nd1trunwevijj38
Inclusion of new installation framework with ties to zend layout and dojo layout

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/**
 
3
 * Zend Framework
 
4
 *
 
5
 * LICENSE
 
6
 *
 
7
 * This source file is subject to the new BSD license that is bundled
 
8
 * with this package in the file LICENSE.txt.
 
9
 * It is also available through the world-wide-web at this URL:
 
10
 * http://framework.zend.com/license/new-bsd
 
11
 * If you did not receive a copy of the license and are unable to
 
12
 * obtain it through the world-wide-web, please send an email
 
13
 * to license@zend.com so we can send you a copy immediately.
 
14
 *
 
15
 * @category   Zend
 
16
 * @package    Zend_Dojo
 
17
 * @subpackage Form
 
18
 * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
 
19
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 
20
 */
 
21
 
 
22
/** Zend_Form_SubForm */
 
23
require_once 'Zend/Form/SubForm.php';
 
24
 
 
25
/**
 
26
 * Dijit-enabled SubForm
 
27
 * 
 
28
 * @uses       Zend_Form_SubForm
 
29
 * @package    Zend_Dojo
 
30
 * @subpackage Form
 
31
 * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
 
32
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 
33
 * @version    $Id: SubForm.php 10038 2008-07-10 21:45:16Z matthew $
 
34
 */
 
35
class Zend_Dojo_Form_SubForm extends Zend_Form_SubForm
 
36
{
 
37
    /**
 
38
     * Has the dojo view helper path been registered?
 
39
     * @var bool
 
40
     */
 
41
    protected $_dojoViewPathRegistered = false;
 
42
 
 
43
    /**
 
44
     * Constructor
 
45
     * 
 
46
     * @param  array|Zend_Config|null $options 
 
47
     * @return void
 
48
     */
 
49
    public function __construct($options = null)
 
50
    {
 
51
        $this->addPrefixPath('Zend_Dojo_Form_Decorator', 'Zend/Dojo/Form/Decorator', 'decorator')
 
52
             ->addPrefixPath('Zend_Dojo_Form_Element', 'Zend/Dojo/Form/Element', 'element')
 
53
             ->addElementPrefixPath('Zend_Dojo_Form_Decorator', 'Zend/Dojo/Form/Decorator', 'decorator')
 
54
             ->addDisplayGroupPrefixPath('Zend_Dojo_Form_Decorator', 'Zend/Dojo/Form/Decorator')
 
55
             ->setDefaultDisplayGroupClass('Zend_Dojo_Form_DisplayGroup');
 
56
        parent::__construct($options);
 
57
    }
 
58
 
 
59
    /**
 
60
     * Load the default decorators
 
61
     * 
 
62
     * @return void
 
63
     */
 
64
    public function loadDefaultDecorators()
 
65
    {
 
66
        if ($this->loadDefaultDecoratorsIsDisabled()) {
 
67
            return;
 
68
        }
 
69
 
 
70
        $decorators = $this->getDecorators();
 
71
        if (empty($decorators)) {
 
72
            $this->addDecorator('FormElements')
 
73
                 ->addDecorator('HtmlTag', array('tag' => 'dl'))
 
74
                 ->addDecorator('ContentPane');
 
75
        }
 
76
    }
 
77
 
 
78
    /**
 
79
     * Get view 
 
80
     * 
 
81
     * @return Zend_View_Interface
 
82
     */
 
83
    public function getView()
 
84
    {
 
85
        $view = parent::getView();
 
86
        if (!$this->_dojoViewPathRegistered) {
 
87
            if (false === $view->getPluginLoader('helper')->getPaths('Zend_Dojo_View_Helper')) {
 
88
                $view->addHelperPath('Zend/Dojo/View/Helper', 'Zend_Dojo_View_Helper');
 
89
            }
 
90
            $this->_dojoViewPathRegistered = true;
 
91
        }
 
92
        return $view;
 
93
    }
 
94
}