Answer the question
In order to leave comments, you need to log in
Yii2. How to connect shared and separate resources for specific controllers/modules?
We have an AppAsset that connects resources (shared) throughout the application. How to create for example PostAsset, which will connect only to the PostController controller.
Exactly the same question about modules. Created a Post module. How to connect resources for this module?
Answer the question
In order to leave comments, you need to log in
1. Создайте свой набор ресурсов PostAsset, аналогично AppAsset.
2. Подключайте его в нужном представлении контроллера или модуля:
use app\assets\PostAsset;
PostAsset::register($this); // $this - представляет собой объект представления
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question