I
I
Ilya Karavaev2018-10-02 11:18:25
Yii
Ilya Karavaev, 2018-10-02 11:18:25

What is the correct way to configure Yii2 to get a submodule relative URL?

I use the modular structure of the application, allocating a separate module for each group of tasks with everything that follows in its filling. If there is a first-level module, everything is relatively simple, register it in the application config and you can use something like this anywhere: But as soon as the task of registering the module as a submodule with different configuration to get different data sets when using common methods, I get a problem with getting relative URLs for a submodule:
Url::to(['default/index']); // user/default/index

Url::to(['rules/default/index']); // admin/user/rules/default/index вместо admin/rules/default/index

Does anyone know how this can be cured?
The bottom line is that there is a widget that extends Selec2 and encapsulates setting up an ajax request to get records through a search. But if now it is connected as a submodule, the url breaks and does not understand where to go.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question