By default, the view being displayed is specified via the view GET parameter. The name of the GET parameter can be customized via [[viewParam]]. Users specify a view in the format of path/to/view, which translates to the view name ViewPrefix/path/to/view where ViewPrefix is given by [[viewPrefix]]. The view will then be rendered by the [[\yii\base\Controller::render()|render()]] method of the currently active controller. Note that the user-specified view name must start with a word character and can only contain word characters, forward slashes, dots and dashes.
Since: 2.0
Author: Alexander Makarov (sam@rmcreative.ru)
Author: Qiang Xue (qiang.xue@gmail.com)
Inheritance: extends yii\base\Action
Example #1
0
 public function init()
 {
     parent::init();
     $this->battle = null;
     if ($user = Yii::$app->user->identity) {
         $this->battle = Battle::findOne(['id' => Yii::$app->request->get('battle'), 'user_id' => $user->id]);
     }
 }
 public function actions()
 {
     return ['error' => ['class' => 'yii\\web\\ErrorAction'], 'captcha' => ['class' => CaptchaAction::className(), 'fixedVerifyCode' => YII_ENV_DEV ? '5555' : false, 'algorithm' => function () {
         $algo = new Numbers();
         $algo->minLength = 4;
         $algo->maxLength = 4;
         return $algo;
     }], 'page' => ['class' => ViewAction::className(), 'viewPrefix' => 'pages/' . \Yii::$app->language]];
 }
Example #3
0
 public function init()
 {
     $this->previousLanguage = Yii::$app->language;
     Yii::$app->language = 'en-US';
     parent::init();
 }
 /**
  * @inheritdoc
  */
 public function actions()
 {
     return ['error' => ['class' => ErrorAction::className()], 'about' => ['class' => ViewAction::className(), 'defaultView' => 'about']];
 }
Example #5
0
 /**
  * @inheritdoc
  */
 public function actions()
 {
     return ['error' => ['class' => 'yii\\web\\ErrorAction'], 'captcha' => ['class' => 'yii\\captcha\\CaptchaAction', 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null, 'minLength' => 1, 'maxLength' => 4, 'fontFile' => '@yii/captcha/BOTTF.TTF', 'offset' => 2], 'icon' => ['class' => ViewAction::className()]];
 }
Example #6
0
 /**
  * @inheritdoc
  */
 public function actions()
 {
     return ['error' => ['class' => ErrorAction::className()], 'about' => ['class' => ViewAction::className(), 'defaultView' => 'about'], 'captcha' => ['class' => CaptchaAction::className(), 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null, 'backColor' => 0xf5f5f5, 'height' => 34]];
 }
Example #7
0
 /**
  * @return bool
  */
 protected function beforeRun()
 {
     if (parent::beforeRun()) {
         $this->_initBreadcrumbsData();
         $this->_initActionsData();
         $this->_initMetadata();
         return true;
     } else {
         return false;
     }
 }
Example #8
0
 public function init()
 {
     $this->previousTimezone = Yii::$app->timeZone;
     parent::init();
 }
Example #9
0
 public function init()
 {
     parent::init();
     Yii::$app->controller->enableCsrfValidation = false;
     $this->registerTranslations();
 }
 public function actions()
 {
     return ['error' => ['class' => ErrorAction::className()], 'page' => ['class' => ViewAction::className()]];
 }
 public function actions()
 {
     return ['view' => ['class' => \yii\web\ViewAction::className()]];
 }
Example #12
0
 public function init()
 {
     $r = parent::init();
     $this->doInit();
     return $r;
 }
 /**
  * @inheritdoc
  */
 public function actions()
 {
     return ['error' => ['class' => ErrorAction::className()], 'about' => ['class' => ViewAction::className(), 'defaultView' => 'about'], 'language' => ['class' => 'fourteenmeister\\site\\action\\Language', 'languages' => array_keys(Yii::$app->params['availableLanguages'])]];
 }