pmls63 2016-04-29 13:50:58 11657次浏览 2条评论 14 5 0
<?php $model->test=($model->test)?:1?>
<?= $form->field($model, 'test',[
   'options'=>['class' => 'form-group form-md-radios'],
    'template' => '{label}<div class="col-md-9 md-radio-inline">{input}</div>{hint}{error}', 
])->radioList([1=>Yii::t('common','has'),0=>Yii::t('common','not')],
[
    'item' => function($index, $label, $name, $checked, $value) {
        $checked=$checked?"checked":"";
        $return = '<div class="md-radio">';
        $return .= '<input type="radio" id="' . $name . $value . '" name="' . $name . '" value="' . $value . '" class="md-radiobtn"  '.$checked.'>';
        $return .= '<label for="' . $name . $value . '">
                    <span></span>
                    <span class="check"></span>
                    <span class="box"></span>' . ucwords($label) . '</label>';
        $return .= '</div>';
        return $return;
    }
]) ?>
觉得很赞
您需要登录后才可以评论。登录 | 立即注册