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_Image
extends Zend_Form_Element_Xhtml
38 * What view helper to use when using view helper decorator
41 public $helper = 'formImage';
53 protected $_imageValue;
56 * Load default decorators
60 public function loadDefaultDecorators()
62 if ($this->loadDefaultDecoratorsIsDisabled()) {
66 $decorators = $this->getDecorators();
67 if (empty($decorators)) {
68 $this->addDecorator('Tooltip')
69 ->addDecorator('Image')
70 ->addDecorator('Errors')
71 ->addDecorator('HtmlTag', array('tag' => 'dd'))
72 ->addDecorator('Label', array('tag' => 'dt'));
81 * @return Zend_Form_Element_Image
83 public function setImage($path)
85 $this->src
= (string) $path;
94 public function getImage()
100 * Set image value to use when submitted
102 * @param mixed $value
103 * @return Zend_Form_Element_Image
105 public function setImageValue($value)
107 $this->_imageValue
= $value;
112 * Get image value to use when submitted
116 public function getImageValue()
118 return $this->_imageValue
;
122 * Was this element used to submit the form?
126 public function isChecked()
128 $imageValue = $this->getImageValue();
129 return ((null !== $imageValue) && ($this->getValue() == $imageValue));