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

Issue Type: Bug Created: 2010-08-18T05:48:59.000+0000 Last Updated: 2013-03-06T09:58:48.000+0000 Status: Closed Fix version(s): Reporter: Nick Belhomme (nbelhomme) Assignee: None Tags: - Zend_Form

Related issues: - ZF-8325



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()



No comments to display

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.