/**
* Do some initial processing for building a URL
*
* @param SiteRouter &$router Router object
* @param Uri &$uri URI object to process
*
* @return void
*
* @since 4.0.0
*/
public function buildInit(&$router, &$uri)
{
$itemid = $uri->getVar('Itemid');
// If no Itemid and option given, merge in the current requests data
if (!$itemid && !$uri->getVar('option')) {
$uri->setQuery(array_merge($this->getVars(), $uri->getQuery(true)));
}
// If Itemid is given, but no option, set the option from the menu item
if ($itemid && !$uri->getVar('option')) {
if ($item = $this->menu->getItem($itemid)) {
$uri->setVar('option', $item->component);
}
}
}