beforeRun() protected method

You may override this method to do preparation work for the action run. If the method returns false, it will cancel the action.
protected beforeRun ( ) : boolean
return boolean whether to run the action.
 /**
  * @return bool
  */
 public function beforeRun()
 {
     Yii::$app->view->title = 'Update Record';
     Yii::$app->view->params['breadcrumbs'][] = ['label' => 'Review Errors', 'url' => ['review-errors', 'id' => Yii::$app->request->get('id')]];
     Yii::$app->view->params['breadcrumbs'][] = Yii::$app->view->title;
     return parent::beforeRun();
 }
Beispiel #2
0
 protected function beforeRun()
 {
     if (is_callable($this->beforeRun)) {
         return call_user_func($this->beforeRun);
     }
     return parent::beforeRun();
 }
Beispiel #3
0
 /**
  * @return bool
  */
 public function beforeRun()
 {
     //crea interaccion visto
     if (!Yii::$app->user->isGuest) {
         list($municipio, $articulo) = Yii::$app->requestedParams;
         $articulo = $this->findModel($municipio, $articulo);
         $model = new InteraccionForm();
         $model->scenario = InteraccionForm::ESCENARIO_CREAR_VISTO;
         $model->usuario = Yii::$app->user->id;
         $model->visto = InteraccionForm::VISTO;
         $model->articulo = $articulo->idarticulo;
         $model->marcarVisto();
     }
     return parent::beforeRun();
     // TODO: Change the autogenerated stub
 }
Beispiel #4
0
 /**
  * @inheritdoc
  * @throws InvalidCallException if it is used in non-web application.
  * @throws InvalidConfigException if context was not found or incorrect context manager component.
  */
 protected function beforeRun()
 {
     if (!parent::beforeRun()) {
         return false;
     }
     if (!$this->getResponse() instanceof Response || !$this->getRequest() instanceof Request) {
         throw new InvalidCallException(static::className() . ' can be used with web applications only.');
     }
     if (!$this->getContextManager() instanceof ContextManager) {
         if (is_string($this->managerComponent)) {
             throw new InvalidConfigException("Incorrect context manager component name '{$this->contextManager}'.");
         } else {
             throw new InvalidConfigException('Incorrect type of $contextManager property: ' . gettype($this->contextManager) . '.');
         }
     }
     if (!$this->getContextManager()->hasContext($this->context)) {
         throw new InvalidConfigException("Unknown context name: '{$this->context}'.");
     }
     return true;
 }
 /**
  * @return bool
  */
 public function beforeRun()
 {
     Yii::$app->view->title = 'Review Errors';
     Yii::$app->view->params['breadcrumbs'][] = Yii::$app->view->title;
     return parent::beforeRun();
 }
 /**
  * @return bool
  */
 public function beforeRun()
 {
     Yii::$app->view->title = 'Processing File';
     Yii::$app->view->params['breadcrumbs'][] = Yii::$app->view->title;
     return parent::beforeRun();
 }
 /**
  * @return bool
  */
 public function beforeRun()
 {
     Yii::$app->view->title = 'Import Summary';
     Yii::$app->view->params['breadcrumbs'][] = Yii::$app->view->title;
     return parent::beforeRun();
 }
 /** @inheritdoc */
 public function beforeRun()
 {
     $this->controller->getView()->title = $this->title();
     $this->controller->getView()->params['breadcrumbs'] = $this->breadcrumbs();
     return parent::beforeRun();
 }
 /**
  * @return bool
  * @throws Exception
  */
 protected function beforeRun()
 {
     $this->initialRedirectUrl();
     $this->synchronizer = $this->getSynchonizer();
     return parent::beforeRun();
 }
Beispiel #10
0
 /**
  * This method is called right before `run()` is executed.
  * You may override this method to do preparation work for the action run.
  * If the method returns false, it will cancel the action.
  *
  * @return boolean whether to run the action.
  */
 protected function beforeRun()
 {
     $this->ipv4 = Yii::$app->get('ipv4');
     return parent::beforeRun();
 }
 /**
  * @inheritdoc
  */
 public function beforeRun()
 {
     if (is_callable($this->beforeRun)) {
         return call_user_func($this->beforeRun, $this);
     }
     return parent::beforeRun();
 }