XF 2.2 Get parameterbag global

It depends what you're trying to accomplish. You could hook a controller_* event which receives the ParameterBag object directly, or you could hook a dispatch_* event and get it through the RouteMatch object (via $match->getParameterBag()).
 
You can try to construct it dynamically like the thread from URL method does:
PHP:
$routePath = $this->app()->request()->getRoutePathFromUrl($url);
$routeMatch = $this->app()->router($type)->routeToController($routePath);
$params = $routeMatch->getParameterBag();

The current URL can be accessed with:
PHP:
\XF::app()->request()->getRoutePath();
 
Back
Top Bottom