original_string: 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
           */
          if (strpos($handler, '::')) {
              list($widgetName, $handlerName) = explode('::', $handler);
  
              /*
               * Execute the page action so widgets are initialized
               */
              $this->pageAction();
  
              if ($this->fatalError) {
                  throw new SystemException($this->fatalError);
              }
  
              if (!isset($this->widget->{$widgetName})) {
                  throw new SystemException(Lang::get('backend::lang.widget.not_bound', ['name'=>$widgetName]));
              }
  
              if (($widget = $this->widget->{$widgetName}) && $widget->methodExists($handlerName)) {
                  $result = $this->runAjaxHandlerForWidget($widget, $handlerName);
                  return $result ?: true;
              }
          }
          else {
              /*
               * Process page specific handler (index_onSomething)
               */
              $pageHandler = $this->action . '_' . $handler;
  
              if ($this->methodExists($pageHandler)) {
                  $result = call_user_func_array([$this, $pageHandler], $this->params);
                  return $result ?: true;
              }
  
              /*
               * Process page global handler (onSomething)
               */
              if ($this->methodExists($handler)) {
                  $result = call_user_func_array([$this, $handler], $this->params);
                  return $result ?: true;
              }
  
              /*
               * Cycle each widget to locate a usable handler (widget::onSomething)
               */
              $this->suppressView = true;
              $this->execPageAction($this->action, $this->params);
  
              foreach ((array) $this->widget as $widget) {
                  if ($widget->methodExists($handler)) {
                      $result = $this->runAjaxHandlerForWidget($widget, $handler);
                      return $result ?: true;
                  }
              }
          }
  
          /*
           * Generic handler that does nothing
           */
          if ($handler == 'onAjax') {
              return true;
          }
  
          return false;
      }
code: 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
           */
          if (strpos($handler, '::')) {
              list($widgetName, $handlerName) = explode('::', $handler);
  
              /*
               * Execute the page action so widgets are initialized
               */
              $this->pageAction();
  
              if ($this->fatalError) {
                  throw new SystemException($this->fatalError);
              }
  
              if (!isset($this->widget->{$widgetName})) {
                  throw new SystemException(Lang::get('backend::lang.widget.not_bound', ['name'=>$widgetName]));
              }
  
              if (($widget = $this->widget->{$widgetName}) && $widget->methodExists($handlerName)) {
                  $result = $this->runAjaxHandlerForWidget($widget, $handlerName);
                  return $result ?: true;
              }
          }
          else {
              /*
               * Process page specific handler (index_onSomething)
               */
              $pageHandler = $this->action . '_' . $handler;
  
              if ($this->methodExists($pageHandler)) {
                  $result = call_user_func_array([$this, $pageHandler], $this->params);
                  return $result ?: true;
              }
  
              /*
               * Process page global handler (onSomething)
               */
              if ($this->methodExists($handler)) {
                  $result = call_user_func_array([$this, $handler], $this->params);
                  return $result ?: true;
              }
  
              /*
               * Cycle each widget to locate a usable handler (widget::onSomething)
               */
              $this->suppressView = true;
              $this->execPageAction($this->action, $this->params);
  
              foreach ((array) $this->widget as $widget) {
                  if ($widget->methodExists($handler)) {
                      $result = $this->runAjaxHandlerForWidget($widget, $handler);
                      return $result ?: true;
                  }
              }
          }
  
          /*
           * Generic handler that does nothing
           */
          if ($handler == 'onAjax') {
              return true;
          }
  
          return false;
      }
code_tokens: 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
           */ if ( strpos ( $ handler , '::' ) ) { list ( $ widgetName , $ handlerName ) = explode ( '::' , $ handler ) ; /*
               * Execute the page action so widgets are initialized
               */ $ this -> pageAction ( ) ; if ( $ this -> fatalError ) { throw new SystemException ( $ this -> fatalError ) ; } if ( ! isset ( $ this -> widget -> { $ widgetName } ) ) { throw new SystemException ( Lang :: get ( 'backend::lang.widget.not_bound' , [ 'name' => $ widgetName ] ) ) ; } if ( ( $ widget = $ this -> widget -> { $ widgetName } ) && $ widget -> methodExists ( $ handlerName ) ) { $ result = $ this -> runAjaxHandlerForWidget ( $ widget , $ handlerName ) ; return $ result ? : true ; } } else { /*
               * Process page specific handler (index_onSomething)
               */ $ pageHandler = $ this -> action . '_' . $ handler ; if ( $ this -> methodExists ( $ pageHandler ) ) { $ result = call_user_func_array ( [ $ this , $ pageHandler ] , $ this -> params ) ; return $ result ? : true ; } /*
               * Process page global handler (onSomething)
               */ if ( $ this -> methodExists ( $ handler ) ) { $ result = call_user_func_array ( [ $ this , $ handler ] , $ this -> params ) ; return $ result ? : true ; } /*
               * Cycle each widget to locate a usable handler (widget::onSomething)
               */ $ this -> suppressView = true ; $ this -> execPageAction ( $ this -> action , $ this -> params ) ; foreach ( ( array ) $ this -> widget as $ widget ) { if ( $ widget -> methodExists ( $ handler ) ) { $ result = $ this -> runAjaxHandlerForWidget ( $ widget , $ handler ) ; return $ result ? : true ; } } } /*
           * Generic handler that does nothing
           */ if ( $ handler == 'onAjax' ) { return true ; } return false ; }
docstring: Tries to find and run an AJAX handler in the page action.
  The method stops as soon as the handler is found.
  @return boolean Returns true if the handler was found. Returns false otherwise.
docstring_tokens: Tries to find and run an AJAX handler in the page action . The method stops as soon as the handler is found .