~chroot64bit/zivios/gentoo-experimental

« back to all changes in this revision

Viewing changes to application/library/Zend/View/Helper/FormLabel.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_View
 
17
 * @subpackage Helper
 
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_View_Helper_FormElement **/
 
23
require_once 'Zend/View/Helper/FormElement.php';
 
24
 
 
25
/**
 
26
 * Form label helper
 
27
 *
 
28
 * @category   Zend
 
29
 * @package    Zend_View
 
30
 * @subpackage Helper
 
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
 */
 
34
class Zend_View_Helper_FormLabel extends Zend_View_Helper_FormElement
 
35
{
 
36
    /**
 
37
     * Generates a 'label' element.
 
38
     *
 
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.
 
43
     */
 
44
    public function formLabel($name, $value = null, array $attribs = array())
 
45
    {
 
46
        $info = $this->_getInfo($name, $value, $attribs);
 
47
        extract($info); // name, value, attribs, options, listsep, disable, escape
 
48
 
 
49
        // build the element
 
50
        if ($disable) {
 
51
            // disabled; do nothing
 
52
        } else {
 
53
            $value = ($escape) ? $this->view->escape($value) : $value;
 
54
 
 
55
            // enabled; display label
 
56
            $xhtml = '<label'
 
57
                   . ' for="' . $this->view->escape($id) . '"'
 
58
                   . $this->_htmlAttribs($attribs)
 
59
                   . '>' . $value . '</label>';
 
60
        }
 
61
 
 
62
        return $xhtml;
 
63
    }
 
64
}