Zend Framework Decorators - Labels and Checkboxes
Very often it is the smallest things that annoy us the most. It took me a while to figure out why the placement parameter was not changing anything. I started of with the following:
'decorators' => array(
array('Label'),
array('ViewHelper')
)
Unfortunately switching the order between Label and ViewHelper did not change the order of elements. So I found this parameter called “placement”.
'decorators' => array(
array('Label', array('placement' => 'APPEND')),
array('ViewHelper')
)
It can take two values: PREPEND or APPEND. At this point however I did not realize that now the order of Label and ViewHelper did matter. Only the order below will make any difference to the html elements order.
'decorators' => array(
array('ViewHelper'),
array('Label', array('placement' => 'APPEND'))
)
This finally resulted in the desired effect.
You can leave a response, or trackback from your own site.
Next Article
Previous Article
Add Comment
1
Comments


at 11:36 am
Thanks for the pointer!
Note that it’s not just the ViewHelper decorator that this applies to, but other core markup generators such as the ViewScript decorator.