/** * @param \yii\base\Action $action * * @return bool */ public function beforeAction($action) { if (parent::beforeAction($action)) { if (is_file(Yii::getAlias('@app/templates/default/layout.php'))) { $this->layout = '@app/templates/default/layout.php'; } return true; } return false; }
/** * @inheritdoc */ public function beforeAction($action) { if (parent::beforeAction($action)) { if ($this->enableOnlyActions !== [] and in_array($action->id, $this->_implementedActions) and !in_array($action->id, $this->enableOnlyActions)) { throw new NotFoundHttpException('Page not found'); } if (in_array($action->id, $this->disabledActions)) { throw new NotFoundHttpException('Page not found'); } return true; } return false; }