Answer the question
In order to leave comments, you need to log in
What is the best way to display a widget with parameters from the controller in the layout?
The task is to display the widget in the layout with type parameters: region, etc., these parameters are obtained in the controller action, how best to transfer from the controller to the layout?
ps in Yii 1 (it wasn't exactly MVC), this task was solved by defining a controller property, and since $this in view and layout pointed to the controller, then the parameter to get was of the type: $this->param. What is the right way to approach now?
Answer the question
In order to leave comments, you need to log in
How to pass param from controller to layout in YII2
Controller:
Views + Layout:
/* @var $this yii\web\View */
echo $this->params['customParam'];
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question