Answer the question
In order to leave comments, you need to log in
How to call frontend Yii:$app function from backend?
Good afternoon, I installed a plugin which is a theme manager for the front of the site, plugin .
The question is that to change the theme you need to call a function
\Yii::$app->view->theme->changeTheme('themeName');, but when you try to call it from the backend controller, it says that there is no such function (it is clear for what reasons). And the logical question is brewing: how to call this frontend function from the backend part, where is it?
Answer the question
In order to leave comments, you need to log in
The fact is that backend and frontend are two different applications and when you do something in the backend, the frontend config is missing.
Therefore, I see several options:
1. Move the connection of this module to a separate file, which is overwritten
2. Insert variables from the database into the configuration, store them there
3. Make an action in the frontend and call it from the backend, will be able to manipulate with your module.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question