ZF-3580: add CLASS= html attribute for Zend/View/Helper/FormSelect.php, like: <option class="dojoDndItem" label="toto" value="toto">

Description

Some javascript frameworks use arbitrary tags, for example Dojo can use class="dojoDndItem" to make some <OPTIONS drag and dropable.

The protected function _build($value, $label, $selected, $disable) into Zend/View/Helper/FormSelect.php lacks of optionnal CLASS= html attrib. for each OPTION. what about a new function _build($value, $label, $selected, $disable, $optionalsAttribs= null) ? with $optionalsAttribs an associative array like ;

$optionalsAttribs= array( 'class' => 'dojoDndItem', 'dndType'=> 'foo'); ... renders:

It can be done programmatically in js.

Comments

It's all you. :)

My fix: [http://paste.jabbim.cz/5186] Example with red background: $combobox = new Zend_Form_Element_Select('list'); $combobox->addMultiOption('value', 'visibleText', array('style'=>'background-color: #FF0000;'));

Martin, your paste link is dead, could you share your code again please ? Thanks.