K
K
kolya_krut2017-11-30 21:18:40
Twig
kolya_krut, 2017-11-30 21:18:40

How to pass class name in Twig?

How does Yii2, using the Twig template engine, replicate this Yii2 construct:

<?= $form->field($model, 'attrubute')->widget(DatePicker::className(), []); ?>

??
It is necessary not just date_picker_widget()(it works), but as part of the ActiveForm widget.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kolya_krut, 2017-12-01
@kolya_krut

{{ form.field(model, 'attribute').widget('yii\\jui\\DatePicker')|raw }}

escaping slashes is important. in my case without it there was an error, which caused the question:
Error
Class 'yiijuiDatePicker' not found

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question