Trouble with assets of widget inside another widget Yii2

97 Views Asked by At

I try to render widget into another widget and I have trouble with assets.

class MyWidget extends Widget
{
    public function run()
    {
        $form = ActiveForm::begin();
        ActiveForm::end();
    }
}

In browser console i have jQuery(...).yiiActiveForm is not a function message.

If I add \yii\widgets\ActiveFormAsset::register($this) into layout then all works.

0

There are 0 best solutions below