本文整理汇总了PHP中yii\base\Action::beforeRun方法的典型用法代码示例。如果您正苦于以下问题:PHP Action::beforeRun方法的具体用法?PHP Action::beforeRun怎么用?PHP Action::beforeRun使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\base\Action
的用法示例。
在下文中一共展示了Action::beforeRun方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeRun
/**
* @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();
}
示例2: beforeRun
protected function beforeRun()
{
if (is_callable($this->beforeRun)) {
return call_user_func($this->beforeRun);
}
return parent::beforeRun();
}
示例3: beforeRun
/**
* @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
}
示例4: beforeRun
/**
* @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;
}
示例5: beforeRun
/**
* @return bool
*/
public function beforeRun()
{
Yii::$app->view->title = 'Review Errors';
Yii::$app->view->params['breadcrumbs'][] = Yii::$app->view->title;
return parent::beforeRun();
}
示例6: beforeRun
/** @inheritdoc */
public function beforeRun()
{
$this->controller->getView()->title = $this->title();
$this->controller->getView()->params['breadcrumbs'] = $this->breadcrumbs();
return parent::beforeRun();
}
示例7: beforeRun
/**
* @return bool
* @throws Exception
*/
protected function beforeRun()
{
$this->initialRedirectUrl();
$this->synchronizer = $this->getSynchonizer();
return parent::beforeRun();
}
示例8: beforeRun
/**
* 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();
}
示例9: beforeRun
/**
* @inheritdoc
*/
public function beforeRun()
{
if (is_callable($this->beforeRun)) {
return call_user_func($this->beforeRun, $this);
}
return parent::beforeRun();
}