There is a base class for all modules.
namespace app\components; use Yii; class Module extends \yii\base\Module { public function init() { parent::init(); var_dump(Yii::$app->controller->id); // null :( } }
All modules expand from it, i.e.
namespace app\modules\test; class Module extends \app\components\Module { // }
How can I get the name of the current controller in the base class of the module?
Yii::$app->controller->id
returns null