Added backend.ajax.beforeRunHandler event
This commit is contained in:
parent
48626a44a1
commit
2c82b05062
|
|
@ -498,6 +498,39 @@ class Controller extends Extendable
|
|||
*/
|
||||
protected function runAjaxHandler($handler)
|
||||
{
|
||||
/**
|
||||
* @event 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);
|
||||
* }
|
||||
* }
|
||||
* });
|
||||
*
|
||||
*/
|
||||
if ($event = $this->fireSystemEvent('backend.ajax.beforeRunHandler', [$handler])) {
|
||||
return $event;
|
||||
}
|
||||
|
||||
/*
|
||||
* Process Widget handler
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue