Issues

ZF-10332: Zend_View_Helper_FormLabel $attribs screwed up for $id

Description

When trying to call formLabel($name, $value = null, array $attribs = array()) with $attribs = array( 'id' => 'someid', 'class' => 'optional', )

_getinfo() builds $info AND makes available a limited attribs array: $info['attribs'] = array( 'class' => 'optional', )

extract($info) overwrites effectively the $attribs array and thus removes the 'id' index. $this->_htmlAttribs($attribs) then causes id to be never set...

... effectively making the following code useless: $this->form->getElement('otherpets')->getDecorator('Label')->setOption('id', 'someid'); echo $this->form->getElement('otherpets')->renderLabel();

renders: Andere instead of Andere

In my opinion the passed 'id' should not be used for referring to other elements, but to have the attribute. Thus $attribs should contain a 'for' key when passed to the view helper AND the viewhelper should use $attribs['for'] for building the for attribute and NOT discard the $attribs['id'] key in the _getinfo()+extract()

Nick

Comments

No comments to display