• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Lack of interest New Code Event Request

xf_phantom

Well-known member
#1
Could we get a new event, which will be fired here:
Code:
  protected function _getValidatedController($controllerName, $action, XenForo_RouteMatch $routeMatch)
   {
     $newControllerName = XenForo_Application::resolveDynamicClass($controllerName, 'controller');
     if ($newControllerName)
     {
       $controller = new $newControllerName($this->_request, $this->_response, $routeMatch);
XenForo_CodeEvent::fire('controller_create', array($this, $controller, &$action));
       if (method_exists($controller, 'action' . $action) && $this->_dependencies->allowControllerDispatch($controller, $action))
       {
         return $controller;
       }
     }

     return null;
   }
This way, we could change the action name before it gets called.


My problem is, that _getValidatedController will return null, if the method actionX doesn't exist and i can't do ANYTHING inside the controller, to change this behaviour (e.g. start a new reroute)

PHP:
$controller = $this->_getValidatedController($controllerName, $action, $routeMatch);
       if ($controller)
       {
         try
         {
           try
           {
             $controller->preDispatch($action, $controllerName);
             $controllerResponse = $controller->{'action' . $action}();
           }
           catch (XenForo_ControllerResponse_Exception $e)
           {
             $controllerResponse = $e->getControllerResponse();
           }

           $controller->postDispatch($controllerResponse, $controllerName, $action);
           $reroute = $this->_handleControllerResponse($controllerResponse, $controllerName, $action);
         }