Issues

ZF-3413: Improvement to Label decorator

Issue Type: Sub-task Created: 2008-06-08T13:20:18.000+0000 Last Updated: 2012-05-11T14:25:00.000+0000 Status: Closed Fix version(s): Reporter: Cristian Bichis (avantis) Assignee: Frank Brückner (frosch) Tags: - Zend_Form

Related issues: - ZF-11035

Attachments:

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:

<pre class="highlight">

Author

``

I setup form elements decorators as:

<pre class="highlight">
$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:

<pre class="highlight">

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:

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

generates code like this

<pre class="highlight"> 

Adresa stránky

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

Have you found an issue?

See the Overview section for more details.

Copyright

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

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

Contacts