Closed ghost closed 5 years ago
<?php $form = ActiveForm::begin([ 'id' => 'form-step', 'layout' => 'horizontal', **'fieldClass' => 'yii\bootstrap4\ActiveField',** 'fieldConfig' => [ 'options' => ['class' => 'form-group row'], 'horizontalCssClasses' => [ 'label' => 'col-lg-6', 'error' => 'invalid-tooltip row px-3', 'wrapper' => 'col-lg-6 position-relative', ], ], 'options' => ['class' => 'pr-md-3 pr-lg-0 w-100'], ]) ?>
<?= $form->field($model, 'type', ['horizontalCssClasses' => ['wrapper' => 'col-xl-8 col-lg-10 position-relative']])->radioList(ArrayHelper::map($model->getTypeProject(), 'value', 'name'), [ 'class' => 'px-3 row', 'aria-expanded' => 'true', 'role' => 'listbox', **'item' => function** ($index, $label, $name, $checked, $value){ switch ($index) { case 0: $checked = ' checked'; $icon = Yii::$app->params['icon_equip']; break; case 1: $icon = Yii::$app->params['icon_mobile']; break; case 2: $icon = Yii::$app->params['icon_target']; break; case 3: $icon = Yii::$app->params['icon_speaker']; break; case 4: $icon = Yii::$app->params['icon_tower']; break; case 5: $icon = Yii::$app->params['icon_program']; break; default: $icon = false; } $return = "<div class='col-6 col-sm-4 px-0'>"; $return .= "<input id='type-{$index}' type='radio' class='d-none check-type' name='{$name}' value='{$value}'" . $checked . ">"; $return .= "<label for='type-{$index}' class='d-flex flex-column h-100 justify-content-center p-4 w-100'>"; $return .= "<span class='mb-4'>{$icon}</span>"; $return .= "<span class='corner'>{$label}</span>"; $return .= '</label>'; return .= "</div>"; return $return; }, ])->label(false) ?>
<div class="form-check"> <input type="radio" id="i0" class="form-check-input" name="AppForm[type]" value="0"> <label class="form-check-label" for="i0">123</label> </div>
<div class="col-6 col-sm-4 px-0"> <input id="type-0" type="radio" class="d-none check-type" name="AppForm[type]" value="0" checked=""> <label for="type-0" class="d-flex flex-column h-100 justify-content-center p-4 w-100"> <span class="mb-4"><svg></svg></span> <span class="corner">123</span> </label> </div>
May you have confused expected with get instead?
What steps will reproduce the problem?
What's expected?
What do you get instead?
Additional info