Skip to content

Commit

Permalink
Correcting Itemid when no menu item
Browse files Browse the repository at this point in the history
  • Loading branch information
infograf768 committed Nov 2, 2018
1 parent 54edf68 commit 7d2fb99
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion administrator/components/com_privacy/models/dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,29 @@ public function getRequestFormPublished()

if (!$menuItem)
{
$status['link'] = JRoute::link('site', 'index.php?option=com_privacy&view=request', true, $linkMode);
if (JLanguageMultilang::isEnabled())
{
// Find the Itemid of the home menu item tagged to the site default language
$defaultSiteLanguage = JComponentHelper::getParams('com_languages')['site'];

$db = $this->getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('id'))
->from($db->quoteName('#__menu'))
->where($db->quoteName('client_id') . ' = 0')
->where($db->quoteName('home') . ' = 1')
->where($db->quoteName('language') . ' = ' . $db->quote($defaultSiteLanguage));
$db->setQuery($query);

$homeId = (int) $db->loadResult();
$itemId = $homeId ? '&Itemid=' . $homeId : '';
}
else
{
$itemId = '';
}

$status['link'] = JRoute::link('site', 'index.php?option=com_privacy&view=request' . $itemId, true, $linkMode);
}
else
{
Expand Down

0 comments on commit 7d2fb99

Please sign in to comment.