Hello Folks,
Can anyone provide me a good link of how to create custom route with detailed explanation? I've got the following code working from one of the tutorial.
class SimpleText_Route_Prefix_SimpleText implements XenForo_Route_Interface
{
public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
{
$action = $router->resolveActionWithIntegerParam($routePath, $request, 'simple_id');
return $router->getRouteMatch('SimpleText_ControllerPublic_SimpleText', $action, 'simpletext');
}
public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
{
return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, 'simple_id');
}
}
And I also understand that, it's binded to "Route Prefixes" on Xenforo admin.
But, a bit of technical explanation of methods like "resolveActionWithIntegerParam", "getRouteMatch" and it's arguments would be handy to understand it altogether.
Also, I'm not sure what the buildLink method stands for and how it's called?
So, a bit detailed documentation on Routing would be really helpful.
Thanks.
Can anyone provide me a good link of how to create custom route with detailed explanation? I've got the following code working from one of the tutorial.
class SimpleText_Route_Prefix_SimpleText implements XenForo_Route_Interface
{
public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
{
$action = $router->resolveActionWithIntegerParam($routePath, $request, 'simple_id');
return $router->getRouteMatch('SimpleText_ControllerPublic_SimpleText', $action, 'simpletext');
}
public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
{
return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, 'simple_id');
}
}
And I also understand that, it's binded to "Route Prefixes" on Xenforo admin.
But, a bit of technical explanation of methods like "resolveActionWithIntegerParam", "getRouteMatch" and it's arguments would be handy to understand it altogether.
Also, I'm not sure what the buildLink method stands for and how it's called?
So, a bit detailed documentation on Routing would be really helpful.
Thanks.