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-2008 Zend Technologies USA Inc. (http://www.zend.com)
19
* @license http://framework.zend.com/license/new-bsd New BSD License
22
/** Zend_View_Helper_FormElement **/
23
require_once 'Zend/View/Helper/FormElement.php';
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
34
class Zend_View_Helper_FormLabel extends Zend_View_Helper_FormElement
37
* Generates a 'label' element.
39
* @param string $name The form element name for which the label is being generated
40
* @param string $value The label text
41
* @param array $attribs Form element attributes (used to determine if disabled)
42
* @return string The element XHTML.
44
public function formLabel($name, $value = null, array $attribs = array())
46
$info = $this->_getInfo($name, $value, $attribs);
47
extract($info); // name, value, attribs, options, listsep, disable, escape
51
// disabled; do nothing
53
$value = ($escape) ? $this->view->escape($value) : $value;
55
// enabled; display label
57
. ' for="' . $this->view->escape($id) . '"'
58
. $this->_htmlAttribs($attribs)
59
. '>' . $value . '</label>';