User tests: Successful: Unsuccessful:
This implements classes for the component routers. Up till now the routers were based on two functions that the component had to provide, now a component should provide one class which extends from the JComponentRouter interface and provides the two methods build() and parse(). The benefit is, that developers now can extend from a base class and thus abstract some of the code out into those base classes. In a future PR, we can then implement a generic base class, which does most of the heavy lifting for the component routing.
Component developers now must simply wrap their routers in a class named Router, which implements the interface JComponentRouter. They can provide fallback functions that create an instance of that class and execute the build() or parse method. The code could look like this:
class ExampleRouter implements JComponentRouter
{
public function build(&$query) {...}
public function parse(&$segments){...}
}
function ExampleBuildRoute(&$query) {$router = new ExampleRouter; return $router->build($query);}
function ExampleParseRoute($segments) {$router = new ExampleRouter; return $router->parse($segments);}
That way, components can handle both the old and the new routers.
For legacy or missing routers, we have the JComponentRouterLegacy class, which wraps those old routers or provides an empty router in case the component does not provide one.
Hi Hannes,
Can you sync this with staging?
Thanks for submitting!
Here is the tracker item: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=32736&start=0