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.
18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
22 /** Zend_Form_Element_Xhtml */
23 require_once 'Zend/Form/Element/Xhtml.php';
31 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32 * @license http://framework.zend.com/license/new-bsd New BSD License
35 class Zend_Form_Element_Submit
extends Zend_Form_Element_Xhtml
38 * Default view helper to use
41 public $helper = 'formSubmit';
46 * @param string|array|Zend_Config $spec Element name or configuration
47 * @param string|array|Zend_Config $options Element value or configuration
50 public function __construct($spec, $options = null)
52 if (is_string($spec) && ((null !== $options) && is_string($options))) {
53 $options = array('label' => $options);
56 if (!isset($options['ignore'])) {
57 $options['ignore'] = true;
60 parent
::__construct($spec, $options);
66 * If no label is present, returns the currently set name.
68 * If a translator is present, returns the translated label.
72 public function getLabel()
74 $value = parent
::getLabel();
76 if (null === $value) {
77 $value = $this->getName();
80 if (null !== ($translator = $this->getTranslator())) {
81 return $translator->translate($value);
88 * Has this submit button been selected?
92 public function isChecked()
94 $value = $this->getValue();
99 if ($value != $this->getLabel()) {
109 * Uses only 'Submit' and 'DtDdWrapper' decorators by default.
113 public function loadDefaultDecorators()
115 if ($this->loadDefaultDecoratorsIsDisabled()) {
119 $decorators = $this->getDecorators();
120 if (empty($decorators)) {
121 $this->addDecorator('Tooltip')
122 ->addDecorator('ViewHelper')
123 ->addDecorator('DtDdWrapper');