public static function getCategoryRoute($catid, $catidAlias = '')
{
// TEST SOLUTION
$app = Factory::getApplication();
$menu = $app->getMenu();
$active = $menu->getActive();
$option = $app->input->get('option', '', 'string');
$activeId = 0;
if (isset($active->id)) {
$activeId = $active->id;
}
if ((int) $activeId > 0 && $option == 'com_phocadownload') {
$needles = array('category' => (int) $catid, 'categories' => (int) $activeId);
} else {
$needles = array('category' => (int) $catid, 'categories' => '');
}
if ($catidAlias != '') {
$catid = $catid . ':' . $catidAlias;
}
//Create the link
$link = 'index.php?option=com_phocadownload&view=category&id=' . $catid;
if ($item = self::_findItem($needles)) {
if (isset($item->query['layout'])) {
$link .= '&layout=' . $item->query['layout'];
}
if (isset($item->id)) {
$link .= '&Itemid=' . $item->id;
}
}
return $link;
}