Zend Framework Checkbox Decorators

2020-05-28 10:45发布

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?

2条回答
The star\"
2楼-- · 2020-05-28 11:05

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

查看更多
Anthone
3楼-- · 2020-05-28 11:27
$this->getElement('elementId')->addDecorator('Label', array('placement' => 'APPEND'))

the placement option can take APPEND or PREPEND as value

查看更多
登录 后发表回答