jeudi 21 février 2019

Yii2 form checkbox template

I set the form parameters:

<?
$form = ActiveForm::begin([
    'id' => 'activeForm',
    'action' => 'javascript://',
]);

$checkboxTemplate = '<div class="checkbox">{labelTitle}{beginLabel}{input}<span class="slider round"></span>{endLabel}{error}{hint}</div>';
echo $form->field($aclForm, tbl_RbacActions::IS_DEVELOPMENT)
    ->checkbox([
        'labelOptions' => ['class' => 'switch'],
        'template' => $checkboxTemplate
]);
?>

As a result, it still turns a standard form with standart classes:

<form id="Index-form" class="row col-12 no-gutters" action="javascript://" method="post">
    <input type="hidden" name="_csrf-frontend" value="Lo7lVHTJ9wcN5rdfjK-b7AgW8L4OHEaqI9IsVofZPOl3yKkFBJqAQz-i-y7H3-mdMUmY-H1RcMRBhkU01-F2oA==">
    <div class="form-group field-aclform-is_development required">
        <input type="hidden" name="AclForm[is_development]" value="0">
        <label class="switch">
            <input type="checkbox" id="aclform-is_development" name="AclForm[is_development]" value="1" template="{input}{beginLabel}{labelTitle}{endLabel}{error}"> Is Development</label>
        <div class="help-block"></div>
    </div>
</form>

Why is it adding the template as the input attribute?




Aucun commentaire:

Enregistrer un commentaire