Varien_Data_Form_Element_Radios Class Reference

Inheritance diagram for Varien_Data_Form_Element_Radios:

Varien_Data_Form_Element_Abstract Varien_Data_Form_Abstract Varien_Object

List of all members.

Public Member Functions

 __construct ($attributes=array())
 getSeparator ()
 getElementHtml ()

Protected Member Functions

 _optionToHtml ($option, $selected)


Detailed Description

Definition at line 34 of file Radios.php.


Constructor & Destructor Documentation

__construct ( attributes = array()  ) 

Enter description here...

Parameters:
array $attributes

Reimplemented from Varien_Data_Form_Element_Abstract.

Definition at line 36 of file Radios.php.

00037     {
00038         parent::__construct($attributes);
00039         $this->setType('radios');
00040     }


Member Function Documentation

_optionToHtml ( option,
selected 
) [protected]

Definition at line 64 of file Radios.php.

00065     {
00066         $html = '<input type="radio"'.$this->serialize(array('name', 'class', 'style'));
00067         if (is_array($option)) {
00068             $html.= 'value="'.$this->_escape($option['value']).'"  id="'.$this->getHtmlId().$option['value'].'"';
00069             if ($option['value'] == $selected) {
00070                 $html.= ' checked="checked"';
00071             }
00072             $html.= ' />';
00073             $html.= '<label class="inline" for="'.$this->getHtmlId().$option['value'].'">'.$option['label'].'</label>';
00074         }
00075         elseif ($option instanceof Varien_Object) {
00076             $html.= 'id="'.$this->getHtmlId().$option->getValue().'"'.$option->serialize(array('label', 'title', 'value', 'class', 'style'));
00077             if (in_array($option->getValue(), $selected)) {
00078                 $html.= ' checked="checked"';
00079             }
00080             $html.= ' />';
00081             $html.= '<label class="inline" for="'.$this->getHtmlId().$option->getValue().'">'.$option->getLabel().'</label>';
00082         }
00083         $html.= $this->getSeparator() . "\n";
00084         return $html;
00085     }

getElementHtml (  ) 

Reimplemented from Varien_Data_Form_Element_Abstract.

Definition at line 51 of file Radios.php.

00052     {
00053         $html = '';
00054         $value = $this->getValue();
00055         if ($values = $this->getValues()) {
00056             foreach ($values as $option) {
00057                 $html.= $this->_optionToHtml($option, $value);
00058             }
00059         }
00060         $html.= $this->getAfterElementHtml();
00061         return $html;
00062     }

getSeparator (  ) 

Definition at line 42 of file Radios.php.

00043     {
00044         $separator = $this->getData('separator');
00045         if (is_null($separator)) {
00046             $separator = '&nbsp;';
00047         }
00048         return $separator;
00049     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:25:00 2009 for Magento by  doxygen 1.5.8