Answer the question
In order to leave comments, you need to log in
How to use widgets outside of php?
Hi friends!
There is a widget in Yii for example Select2:
<?php echo Select2::widget([
'name' => 'hiddenselect',
'data' => $data,
'options' => ['placeholder' => 'Выберите...'],
'pluginOptions' => [
'allowClear' => true
],
]);
?>
Answer the question
In order to leave comments, you need to log in
Connect the asset yourself.
UPD.
My joy , in order to begin to understand, you need to read the code of the framework, and the packages that you use. For example, in the case of Select2, the asset you need is connected in the registerAssetBundle
method
. As soon as you go through the chain of calls, you will understand that all this is launched from the run () method, which is launched by the framework.
To solve your problem, inside the registerAssetBundle method, find which class is being connected and register it yourself in your view file.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question