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

Get Called Route Class

xf_phantom

Well-known member
#1
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:

xf_phantom

Well-known member
#2
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: