controller_before.*

Triggered before execution of a specified PHP controller.

Team

Input (passed by reference)

$params['controller'] waViewController Controller class instance.
$params['params'] array|null Parameters passed to the controller class.
… your plugin code …

Output

%plugin_id%
A plugin may return false to prevent the controller from execution.
Team

Plugin code example

PHP

/**
 * 'handlers' => [
 *     'controller_before.teamProfileAction' => 'controllerBeforeTeamProfileAction',
 * ],
 */
public function controllerBeforeTeamProfileAction(&$params)
{
    if (!teamMyPlugin::canViewUserProfile()) {
        wa()->getResponse()->redirect(wa()->getAppUrl('team'));
        return false;
    }
}