/** * Renders common page view. * @param string $url relative url from route. * @return string * @throws \yii\web\HttpException */ public function actionView($url = '/') { /** * @var Item $model */ if (!($model = Item::getCurrentPage($url))) { throw new \yii\web\HttpException(404, \Yii::t('modules/page', "Page not found")); } if ($model->layout) { $this->layout = $model->layout; } return $this->render('view', compact('model')); }
/** * @inheritdoc */ public function parseRequest($manager, $request) { if (!($result = parent::parseRequest($manager, $request))) { return false; } if ($this->enforceSeo) { Item::getCurrentPage($request->pathInfo); // sets seo meta tags } $manager->rules = array_filter($manager->rules, function ($rule) { return !$rule instanceof $this; }); if (!($result2 = $manager->parseRequest($request))) { return $result; } return \Yii::$app->createController($result2[0]) ? $result2 : $result; }