Zend Framework Checkbox Decorators
Asked Answered
M

2

8

What I am trying to accomplish is to have checkbox labels display after checkbox input fields (to the right of them).

I am using these decorators now:

private $checkboxDecorators = array(
    Label,
    array(array('data' => 'HtmlTag'), array('tag' => 'div', 'class' => 'checkbox')),
    'ViewHelper',
    array(array('row' => 'HtmlTag'), array('tag' => 'li')),
);

I have tried switching the Label and ViewHelper decorators but that did nothing. Any suggestions?

Manamanacle answered 21/7, 2009 at 11:37 Comment(0)
S
29
$this->getElement('elementId')->addDecorator('Label', array('placement' => 'APPEND'))

the placement option can take APPEND or PREPEND as value

Smetana answered 21/7, 2009 at 12:11 Comment(1)
I needed that! Or you could use $this->getElement('elementId')->getDecorator('label')->setOption('placement', 'APPEND');Runnymede
A
3

I know that is an older question, but you can also use

$element->getDecorator('label')->setOption('placement', 'APPEND');

if it is an already created element with an existing decorator

Advisable answered 19/11, 2011 at 21:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.