* @copyright (c), Thread */ class ArticleController extends \frontend\components\BaseController { public $title = "Article"; public $defaultAction = 'index'; public $layout = "@app/layouts/base"; /** * */ public function init() { parent::init(); $this->breadcrumbs = [ [ 'label' => Yii::t('news', 'Blog'), 'url' => ['/news/list/index'] ] ]; } /** * @return array */ public function behaviors() { return [ 'verbs' => [ 'class' => VerbFilter::class, 'actions' => [ 'index' => ['get'], ], ], ]; } /** * @param $alias * @return string * @throws NotFoundHttpException */ public function actionIndex($alias) { $model = Article::getByAlias($alias); if ($model == null) { throw new NotFoundHttpException; } //group // if ($model['group_id'] > 0) { // $this->breadcrumbs[] = [ // 'label' => $model['group']['lang']['title'], // 'url' => $model['group']->getUrl() // ]; // } // $this->breadcrumbs[] = [ 'label' => $model['lang']['title'], ]; //SEO Yii::$app->metatag->registerModel($model); //SEO return $this->render('index', [ 'model' => $model, ]); } }