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

This code works for me:

 $myStdDecorators = array(
    'Description' , 
    'Label' ,
    array(
        array('divLbl' => 'HtmlTag') , 
        array('tag' => 'div' , 'class' => 'lbl')
    ) ,
    'ViewHelper',
    'Errors'
);

generates code like this

 
Adresa stránky

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...

Code tags added.