? Pending

User tests: Successful: Unsuccessful:

avatar csthomas
csthomas
9 Oct 2018

Summary of Changes

Sometimes, on the login form we need to create a non SEF url for the return parameter.

Thanks to the fact that the URL is not SEF, we can retrieve Itemid directly from the link without parsing SEF URL.

This PR extracts part of the code and places it in a separate public method.
It could be treated as a backport of SiteRouter::buildComponentPreprocess() from J4.

Testing Instructions

Code review.

Expected result

Woks as before. No changes.

Example of usage:

// SEF link for login page
$link = new Uri(Route::_('index.php?option=com_users&view=login', false));
// Non SEF link without Itemid			
$uri = new Uri(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language));

$router = Factory::getApplication()->getRouter();
// This method adds Itemid=xxx to the link
$router->buildComponentPreprocess($router, $uri);
// Add return parameter to the login URL
$link->setVar('return', base64_encode($uri->toString()));

Documentation Changes Required

New public method SiteRouter::buildComponentPreprocess() available.

avatar csthomas csthomas - open - 9 Oct 2018
avatar csthomas csthomas - change - 9 Oct 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 9 Oct 2018
Category Libraries
avatar csthomas csthomas - change - 9 Oct 2018
Labels Added: ?
avatar Hackwar
Hackwar - comment - 18 Oct 2018

Joomla 3.x already has the preprocess step in the routing. preprocess also is not there to just return the Itemid. You don't know what the component router does in this step, so this PR would either severly limit the stuff that you are allowed to do in your preprocess method or your redirect code would break.

avatar csthomas csthomas - change - 18 Oct 2018
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2018-10-18 10:28:19
Closed_By csthomas
avatar csthomas csthomas - close - 18 Oct 2018

Add a Comment

Login with GitHub to post a comment