File indexing completed on 2024-12-22 05:36:42

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category   Zend
0016  * @package    Zend_Form
0017  * @subpackage Element
0018  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0019  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0020  */
0021 
0022 /** Zend_Form_Element_Multi */
0023 // require_once 'Zend/Form/Element/Multi.php';
0024 
0025 /**
0026  * Radio form element
0027  *
0028  * @category   Zend
0029  * @package    Zend_Form
0030  * @subpackage Element
0031  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0032  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0033  * @version    $Id$
0034  */
0035 class Zend_Form_Element_Radio extends Zend_Form_Element_Multi
0036 {
0037     /**
0038      * Use formRadio view helper by default
0039      * @var string
0040      */
0041     public $helper = 'formRadio';
0042 
0043     /**
0044      * Load default decorators
0045      *
0046      * Disables "for" attribute of label if label decorator enabled.
0047      *
0048      * @return Zend_Form_Element_Radio
0049      */
0050     public function loadDefaultDecorators()
0051     {
0052         if ($this->loadDefaultDecoratorsIsDisabled()) {
0053             return $this;
0054         }
0055         parent::loadDefaultDecorators();
0056 
0057         // Disable 'for' attribute
0058         if (isset($this->_decorators['Label'])
0059             && !isset($this->_decorators['Label']['options']['disableFor']))
0060         {
0061              $this->_decorators['Label']['options']['disableFor'] = true;
0062         }
0063 
0064         return $this;
0065     }
0066 }