/**
  * @return array
  */
 public function behaviors()
 {
     $behaviors = parent::behaviors();
     if ($this->module->enablePageCache) {
         $behaviors['content-page-cache'] = ['class' => 'yii\\filters\\PageCache', 'duration' => $this->module->pageCacheTime, 'variations' => array_merge($this->module->additionalPageCacheVariations, [Yii::$app->language, Yii::$app->user->isGuest, Yii::$app->request->isAjax, Yii::$app->request->pathInfo]), 'dependency' => new TagDependency(['tags' => [ContentModule::CACHE_TAG, ContentModule::PAGE_CACHE_TAG]])];
     }
     return $behaviors;
 }
Esempio n. 2
0
 /**
  * @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;
 }