User tests: Successful: Unsuccessful:
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.
Code review.
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()));
New public method SiteRouter::buildComponentPreprocess()
available.
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
Labels |
Added:
?
|
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-10-18 10:28:19 |
Closed_By | ⇒ | csthomas |
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.