Zend Framework Checkbox Decorators

試著忘記壹切 提交于 2019-12-03 13:00:17

问题


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?


回答1:


$this->getElement('elementId')->addDecorator('Label', array('placement' => 'APPEND'))

the placement option can take APPEND or PREPEND as value




回答2:


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



来源:https://stackoverflow.com/questions/1158671/zend-framework-checkbox-decorators

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!