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.
This is the updated PR for #2538
Here is the tracker item: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=32736&start=0
As reported on the tracker, tested good with core and K2, but ran into some issues with sh404sef.
Added the proxy functions..
Closing as merged into 3.3-dev branch
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2014-03-03 07:31:48 |
yay :) Thanks Hannes :) :)
Test went fine here, thanks Hannes!