Added cms.ajax.beforeRunHandler event

This commit is contained in:
Luke Towers 2018-04-19 10:26:50 -06:00
parent ed760d892b
commit 92e346296e
1 changed files with 22 additions and 0 deletions

View File

@ -687,6 +687,28 @@ class Controller
*/
protected function runAjaxHandler($handler)
{
/**
* @event cms.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):
*
* $this->controller->bindEvent('ajax.beforeRunHandler', function ($handler) {
* if (strpos($handler, '::')) {
* list($componentAlias, $handlerName) = explode('::', $handler);
* if ($componentAlias === $this->getBackendWidgetAlias()) {
* return $this->backendControllerProxy->runAjaxHandler($handler);
* }
* }
* });
*
*/
if ($event = $this->fireSystemEvent('cms.ajax.beforeRunHandler', [$handler])) {
return $event;
}
/*
* Process Component handler
*/