ZF-3413: Improvement to Label decorator
Description
As discusses on fw-mvc with Matthew i am posting here a possible improvement for Label decorator:
{quote} I am trying to render form elements fully using dvs, each one with his own classes. Sample:
Author
I setup form elements decorators as:
$form->setElementDecorators(
array(
array('ViewHelper'),
array('Errors'),
array('decorator'=>array('div1'=>'HtmlTag'), 'options'=>array('tag' => 'div', 'class'=>'data')),
array('decorator'=>array('div2'=>'Label'), 'options'=>array('tag' => 'div', 'class'=>'label')),
array('decorator'=>array('div3'=>'HtmlTag'), 'options'=>array('tag' => 'div', 'class'=>'line'))
)
);
There is however a problem. For Label decorator class is rendered as class for label tag not for surrounding tag
<
div>.
So it renders as:
Author
What i am missing on setElementDecorators to do so ? {quote} Nothing; the label decorator simply does not support that functionality at this time. You can override the existing Label decorator or create your own implementation to do so, but it is not currently supported.
Comments
Posted by Tomáš Fejfar (tomas.fejfar@gmail.com) on 2008-07-28T17:13:06.000+0000
This code works for me:
generates code like this
Adresa stránkyPosted by Cristian Bichis (avantis) on 2008-07-28T21:01:14.000+0000
Ok, but this does't help in case i want to assign a different class for each form element div, so to have different classes instead of "lbl" depending on element...
Posted by Frank Brückner (frosch) on 2012-04-26T12:04:23.000+0000
Code tags added.