*/ class Varien_Data_Form_Element_Select extends Varien_Data_Form_Element_Abstract { public function __construct($attributes=array()) { parent::__construct($attributes); $this->setType('select'); $this->setExtType('combobox'); $this->_prepareOptions(); } public function getElementHtml() { $this->addClass('select'); $html = ''."\n"; $html.= $this->getAfterElementHtml(); return $html; } protected function _optionToHtml($option, $selected) { if (is_array($option['value'])) { $html =''."\n"; foreach ($option['value'] as $groupItem) { $html .= $this->_optionToHtml($groupItem, $selected); } $html .=''."\n"; } else { $html = ''."\n"; } return $html; } protected function _prepareOptions() { $values = $this->getValues(); if (empty($values)) { $options = $this->getOptions(); if (is_array($options)) { $values = array(); foreach ($options as $value => $label) { $values[] = array('value' => $value, 'label' => $label); } } elseif (is_string($options)) { $values = array( array('value' => $options, 'label' => $options) ); } $this->setValues($values); } } public function getHtmlAttributes() { return array('title', 'class', 'style', 'onclick', 'onchange', 'disabled', 'readonly', 'tabindex'); } }