? Success

User tests: Successful: Unsuccessful:

avatar Hackwar
Hackwar
22 Feb 2014

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

avatar Hackwar Hackwar - open - 22 Feb 2014
avatar chivitli
chivitli - comment - 26 Feb 2014

Test went fine here, thanks Hannes!

avatar betweenbrain
betweenbrain - comment - 28 Feb 2014

As reported on the tracker, tested good with core and K2, but ran into some issues with sh404sef.

avatar Hackwar
Hackwar - comment - 1 Mar 2014

Added the proxy functions..

avatar mbabker mbabker - reference | - 3 Mar 14
avatar Bakual
Bakual - comment - 3 Mar 2014

Closing as merged into 3.3-dev branch

avatar Bakual Bakual - change - 3 Mar 2014
Status New Closed
Closed_Date 0000-00-00 00:00:00 2014-03-03 07:31:48
avatar Bakual Bakual - close - 3 Mar 2014
avatar Bakual Bakual - close - 3 Mar 2014
avatar wilsonge
wilsonge - comment - 3 Mar 2014

yay :) Thanks Hannes :) :)

avatar pgkerr76 pgkerr76 - reference | c40f1c2 - 26 Apr 14
avatar Bakual Bakual - reference | 587b3a4 - 12 May 14
avatar Hackwar Hackwar - head_ref_deleted - 6 Jan 2016

Add a Comment

Login with GitHub to post a comment