Skip to content

Commit

Permalink
Fix build SEF URL for users registration view without own menu item
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomasz Narloch committed Nov 29, 2017
1 parent f66449e commit 043d800
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions libraries/src/Router/SiteRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -465,9 +465,6 @@ public function buildComponentPreprocess(&$router, &$uri)
*/
public function buildSefRoute(&$router, &$uri)
{
// Get the route
$route = $uri->getPath();

// Get the query data
$query = $uri->getQuery(true);

Expand All @@ -478,35 +475,29 @@ public function buildSefRoute(&$router, &$uri)

// Build the component route
$component = preg_replace('/[^A-Z0-9_\.-]/i', '', $query['option']);
$itemID = !empty($query['Itemid']) ? $query['Itemid'] : null;
$crouter = $this->getComponentRouter($component);
$parts = $crouter->build($query);
$tmp = trim(implode('/', $parts));

if (empty($query['Itemid']) && !empty($itemID))
{
$query['Itemid'] = $itemID;
}
$item = isset($query['Itemid']) ? $this->menu->getItem($query['Itemid']) : null;

// Build the application route
if (isset($query['Itemid']) && $item = $this->menu->getItem($query['Itemid']))
if ($item !== null && $query['option'] === $item->component)
{
if (is_object($item) && $query['option'] === $item->component)
if (!$item->home)
{
if (!$item->home)
{
$tmp = !empty($tmp) ? $item->route . '/' . $tmp : $item->route;
}

unset($query['Itemid']);
$tmp = $item->route . '/' . $tmp;
}

unset($query['Itemid']);
}
else
{
$tmp = 'component/' . substr($query['option'], 4) . '/' . $tmp;
}

$route .= '/' . $tmp;
// Get the route
$route = $uri->getPath() . '/' . $tmp;

// Unset unneeded query information
unset($query['option']);
Expand Down

0 comments on commit 043d800

Please sign in to comment.