[ZF-10089] Zend_Log
[zend/radio.git] / library / Zend / Form / Element / Image.php
blob618dc4fdb61b85dd91276787d75ec912f6f29a16
1 <?php
2 /**
3 * Zend Framework
5 * LICENSE
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.
15 * @category Zend
16 * @package Zend_Form
17 * @subpackage Element
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';
25 /**
26 * Image form element
28 * @category Zend
29 * @package Zend_Form
30 * @subpackage Element
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
33 * @version $Id$
35 class Zend_Form_Element_Image extends Zend_Form_Element_Xhtml
37 /**
38 * What view helper to use when using view helper decorator
39 * @var string
41 public $helper = 'formImage';
43 /**
44 * Image source
45 * @var string
47 public $src;
49 /**
50 * Image value
51 * @var mixed
53 protected $_imageValue;
55 /**
56 * Load default decorators
58 * @return void
60 public function loadDefaultDecorators()
62 if ($this->loadDefaultDecoratorsIsDisabled()) {
63 return $this;
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'));
74 return $this;
77 /**
78 * Set image path
80 * @param string $path
81 * @return Zend_Form_Element_Image
83 public function setImage($path)
85 $this->src = (string) $path;
86 return $this;
89 /**
90 * Get image path
92 * @return string
94 public function getImage()
96 return $this->src;
99 /**
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;
108 return $this;
112 * Get image value to use when submitted
114 * @return mixed
116 public function getImageValue()
118 return $this->_imageValue;
122 * Was this element used to submit the form?
124 * @return bool
126 public function isChecked()
128 $imageValue = $this->getImageValue();
129 return ((null !== $imageValue) && ($this->getValue() == $imageValue));