Код: Выделить всё
$template = "{label}\n{input}\n{hint}\n{error}";
или только так?
Код: Выделить всё
<?= $model->property ?>
Код: Выделить всё
$template = "{label}\n{input}\n{hint}\n{error}";
Код: Выделить всё
<?= $model->property ?>
Код: Выделить всё
<div class="form-group">
<?= Html::activeLabel($user, 'email', ['class' => 'col-sm-4 control-label']) ?>
<div class="col-sm-8">
<?= Html::tag('p', $user->email, ['class' => 'form-control-static']) ?>
</div>
</div>
немного даzelenin писал(а):а как еще? это что не решает проблему? или похоже на костыль?
с чего это "немного да"? а как вы еще другим, более прямым способом выводите атрибуты модели во вьюшке?kukuruku писал(а):немного даzelenin писал(а):а как еще? это что не решает проблему? или похоже на костыль?
как вариант readonly, но поле все равно будет отрисовываться
Код: Выделить всё
<?= $form->field($model, 'alias',
[
'template' => "нужный шаблон без {input}",
])
->hint($hint)
->textInput() ?>
это часть формы, а ваши хотелки к форме не относятся.kukuruku писал(а):метод $form->field помимо самих элементов выводит бутстрап верстку
если выводить ручками echo $model->getAttributeLabel('prop') + echo $model->prop придется еще верстку выводит
я подумал что в ActiveField должно быть штатное решение
я хочу вывести value но не в виде input, а виде labelmaleks писал(а):А почему шаблон не изменить?Код: Выделить всё
<?= $form->field($model, 'alias', [ 'template' => "нужный шаблон без {input}", ]) ->hint($hint) ->textInput() ?>
Код: Выделить всё
/**
* Renders Bootstrap static form control.
* @param array $options the tag options in terms of name-value pairs. These will be rendered as
* the attributes of the resulting tag. There are also a special options:
*
* - encode: boolean, whether value should be HTML-encoded or not.
*
* @return $this the field object itself
* @since 2.0.5
*/
public function staticControl($options = [])
{
$this->adjustLabelFor($options);
$this->parts['{input}'] = Html::activeStaticControl($this->model, $this->attribute, $options);
return $this;
}