Back to PhocaDownloadRoute class

Method getCategoriesRoute

public static
getCategoriesRoute
()

Method getCategoriesRoute - Source code

public static function getCategoriesRoute()
{
    // TEST SOLUTION
    $app = Factory::getApplication();
    $menu = $app->getMenu();
    $active = $menu->getActive();
    $activeId = 0;
    if (isset($active->id)) {
        $activeId = $active->id;
    }
    $itemId = 0;
    $option = $app->input->get('option', '', 'string');
    $view = $app->input->get('view', '', 'string');
    if ($option == 'com_phocadownload' && $view == 'category') {
        if ((int) $activeId > 0) {
            // 2) if there are two menu links, try to select the one active
            $itemId = $activeId;
        }
    }
    $needles = array('categories' => '');
    $link = 'index.php?option=com_phocadownload&view=categories';
    if ($item = self::_findItem($needles, 1)) {
        if (isset($item->query['layout'])) {
            $link .= '&layout=' . $item->query['layout'];
        }
        // 1) get standard item id if exists
        if ((int) $itemId > 0) {
            $link .= '&Itemid=' . (int) $itemId;
        } else {
            if (isset($item->id)) {
                $link .= '&Itemid=' . (int) $item->id;
            }
        }
        /*if (isset($item->id)) {
        			$link .= '&Itemid='.$item->id;
        		}*/
    }
    return $link;
}