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

Get Called Route Class

Discussion in 'XenForo Development Discussions' started by xf_phantom, Aug 14, 2013.

  1. xf_phantom

    xf_phantom Well-Known Member

    Does a way exist, to get the current called route class?

    I've tried get_class($dependencies->getRouter())

    but it's not showing the route class, it's just the router "XenForo_Router"

    $dependencies->getRouter()->match(new Zend_Controller_Request_Http());

    also returns only the result and not the route class ( e.g. XenForo_Route_Prefix_Forums )


    Or is the only way to get the route class from the db with help of the current prefix?
     
    Last edited: Aug 14, 2013
  2. xf_phantom

    xf_phantom Well-Known Member

    No idea if there's a better way, that's my current solution:
    PHP:
    $fc XenForo_Application::getFc();
      
    $path $dependencies->getRouter()->getRoutePath($fc->getRequest());
      list(
    $pathClean) = explode('/'$path);
      
    $class XenForo_Link::getPrefixHandlerClassName('public'$pathClean);
      
    $params['route_class'] = $class;


    But i assume it won't work for route filters:/
     
    Last edited: Aug 14, 2013

Share This Page