backend.ajax.beforeRunHandler
Provides an opportunity to modify an AJAX request
The parameter provided is $handler
(the requested AJAX handler to be run)
Example usage (forwards AJAX handlers to a backend widget):
Event::listen('backend.ajax.beforeRunHandler', function ((\Backend\Classes\Controller) $controller, (string) $handler) {
if (strpos($handler, '::')) {
list($componentAlias, $handlerName) = explode('::', $handler);
if ($componentAlias === $this->getBackendWidgetAlias()) {
return $this->backendControllerProxy->runAjaxHandler($handler);
}
}
});
Or
$this->controller->bindEvent('ajax.beforeRunHandler', function ((string) $handler) {
if (strpos($handler, '::')) {
list($componentAlias, $handlerName) = explode('::', $handler);
if ($componentAlias === $this->getBackendWidgetAlias()) {
return $this->backendControllerProxy->runAjaxHandler($handler);
}
}
});
Usage
Triggers
Class or file | Line |
---|---|
Backend\Classes\Controller
|
595 |
Copyright © 2024 Winter CMS