backend\controllers\SiteController::beforeAction PHP Метод

beforeAction() публичный Метод

public beforeAction ( Action $action ) : boolean
$action yii\base\Action
Результат boolean
    public function beforeAction($action)
    {
        if (parent::beforeAction($action)) {
            if ($action->id == 'error' && Yii::$app->user->isGuest) {
                $this->layout = 'main-login';
            }
            return true;
        } else {
            return false;
        }
    }