function _getMenuData(&$params) { $menu = new GantryMenuTree(); $menu->_params =& $params; $items =& JSite::getMenu(); // Get Menu Items $rows = $items->getItems('menutype', $params->get('menutype')); $maxdepth = $menu->getParameter('endLevel', 10); // Build Menu Tree root down (orphan proof - child might have lower id than parent) $user =& JFactory::getUser(); $ids = array(); $ids[0] = true; $last = null; $unresolved = array(); // pop the first item until the array is empty if there is any item if (is_array($rows)) { while (count($rows) && !is_null($row = array_shift($rows))) { $row->ionly = $params->get('menu_images_link'); if (!$menu->addNode($params, $row)) { if (!array_key_exists($row->id, $unresolved) || $unresolved[$row->id] < $maxdepth) { array_push($rows, $row); if (!isset($unresolved[$row->id])) { $unresolved[$row->id] = 1; } else { $unresolved[$row->id]++; } } } } } return $menu; }