Skip to content

Commit

Permalink
Merge pull request #481 from Shnoulle/master_beforeController_event
Browse files Browse the repository at this point in the history
New feature #10571: beforeController event (for web)
  • Loading branch information
Shnoulle committed Apr 22, 2016
2 parents f9c8b7c + 2adc40d commit ecdfce3
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions application/core/LSYii_Application.php
Expand Up @@ -206,5 +206,26 @@ public function getPluginManager()
return $this->getComponent('pluginManager');
}

/**
* The pre-filter for controller actions.
* This method is invoked before the currently requested controller action and all its filters
* are executed. You may override this method with logic that needs to be done
* before all controller actions.
* @param CController $controller the controller
* @param CAction $action the action
* @return boolean whether the action should be executed.
*/
public function beforeControllerAction($controller,$action)
{
/**
* Plugin event done before all web controller action
* Can set run to false to deactivate action
*/
$event = new PluginEvent('beforeControllerAction');
$event->set('controller',$controller->getId());
$event->set('action',$action->getId());
App()->getPluginManager()->dispatchEvent($event);
return $event->get("run",parent::beforeControllerAction($controller,$action));
}

}

0 comments on commit ecdfce3

Please sign in to comment.