function pm_menu_get_links in Drupal PM (Project Management) 7.3
Get all menu defined for particular type.
2 calls to pm_menu_get_links()
- pm_dashboard_get_links in ./
pm.module - Return links array for the pm dashboard.
- pm_menu_admin in includes/
pm.menu.inc - Generates a table of recommended modules.
File
- includes/
pm.menu.inc, line 225 - Drupal Pm Menu Admin settings.
Code
function pm_menu_get_links($type, $hide_inactive = FALSE) {
$links = array();
$menu_items = module_invoke_all('pm_dashboard_links', $type);
if (!empty($menu_items)) {
foreach ($menu_items as $item) {
$id = $item['path'];
$links[$id] = array(
'custom' => FALSE,
'title' => $item['title'],
'icon' => $item['icon'],
'path' => $item['path'],
'weight' => $item['weight'],
'extra_link' => $item['add_type'] ? 'node/add/' . $item['add_type'] : '',
'status' => TRUE,
'id' => $id,
);
}
}
$menu_items = variable_get('pm_dashboard_links_' . $type, array());
if (!empty($menu_items)) {
foreach ($menu_items as $id => $item) {
// Hide the item if only active items have been requeted.
if ($hide_inactive and $item['status'] == FALSE) {
unset($links[$id]);
continue;
}
if ($item['custom'] == FALSE) {
$links[$id]['status'] = $item['status'];
$links[$id]['weight'] = $item['weight'];
}
else {
$links[$id] = $item;
}
}
}
uasort($links, 'drupal_sort_weight');
return $links;
}