【问题标题】:Zend Form Decorators for themeZend Form 主题装饰器
【发布时间】:2016-08-10 07:46:27
【问题描述】:

我有一个新主题,我需要编辑我的装饰器。

除了复选框和收音机之外,我大部分都在工作。

<!-- Previously -->
<div class="form-group ">
    <label for="mobileTheme" class="col-lg-2 control-label optional">Mobiel thema</label>
    <div class="col-lg-5">
        <div class="checkbox">
            <input type="hidden" name="mobileTheme" value="0" />
            <input type="checkbox" name="mobileTheme" id="mobileTheme" value="1" class=" " />
        </div>
        <span class="help-block">Redirect mobiele gebruikers naar een eigen domein met eigen thema</span>
    </div>
</div>

<!-- After -->
<div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
        <div class="checkbox">
            <label>
                <input type="checkbox" value="">
                <i class="input-helper"></i>
                Remember me
            </label>
        </div>
    </div>
</div>

我的装饰器现在看起来像这样:

'checkbox' => array(
            'decorators' => array(
                'ViewHelper',
                array(array('input' => 'HtmlTag'), array('tag' => 'div', 'class' => 'checkbox')),
                array('Errors', array('class' => 'help-inline')),
                array('Description', array('tag' => 'span', 'class' => 'help-block')),
                array('Label', array('class' => 'col-lg-2 control-label')),
                array('HtmlTag', array('tag' => 'div', 'class' => 'col-lg-5')),
                'ElementWrapper'
            ),
            'options' => array(
                'class' => '',
            ),
        ),

我正在努力解决的问题是我不知道如何正确订购装饰器,以便标签现在在 col-*-* 类中

【问题讨论】:

    标签: php zend-framework zend-form zend-decorators


    【解决方案1】:

    我搞定了,

    'checkbox' => array(
                'decorators' => array(
                    'ViewHelper',
                    array('AdditionalElement', array('placement' => 'APPEND', 'tag' => 'i', 'class' => 'input-helper')),
                    array(array('input' => 'HtmlTag'), array('tag' => 'div', 'class' => 'checkbox')),
                    array('Errors', array('class' => 'help-inline')),
                    array('Description', array('tag' => 'span', 'class' => 'help-block')),
                    array('HtmlTag', array('tag' => 'div', 'class' => 'col-lg-5')),
                    array('Label', array('class' => 'col-lg-2 control-label')),
                    'ElementWrapper'
                ),
                'options' => array(
                    'class' => '',
                ),
            ),
    

    AdditionalElement 是我自己的自定义类,用于实现任何 html。

    【讨论】:

      猜你喜欢
      • 2010-12-10
      • 1970-01-01
      • 2011-01-09
      • 1970-01-01
      • 2012-03-18
      • 1970-01-01
      • 2011-07-09
      • 1970-01-01
      • 2011-10-11
      相关资源
      最近更新 更多