function pm_dashboard_get_links in Drupal PM (Project Management) 7
Same name and namespace in other branches
- 8 pm.module \pm_dashboard_get_links()
- 7.3 pm.module \pm_dashboard_get_links()
- 7.2 pm.module \pm_dashboard_get_links()
Return links array for the pm dashboard.
Parameters
bool $check_active: When FALSE, returns all links whether active or not (for admin settings)
string $type: Dashboard type
Return value
array Dashboard links
3 calls to pm_dashboard_get_links()
- pm_admin_settings in ./
pm.module - Defines the administration settings form for the Project Management module
- pm_admin_settings_form_submit in ./
pm.module - Submit function for admin settings form.
- pm_dashboard in ./
pm.module - Function to create a dashboard (call to theme function)
File
- ./
pm.module, line 244 - Main module file for the Project Management module.
Code
function pm_dashboard_get_links($check_active = TRUE, $type = 'page') {
$links = module_invoke_all('pm_dashboard_links', $type);
if (!empty($links)) {
$default_dashboard_settings = variable_get('pm_' . $type . 'dashboard_settings', array());
$weight = 0;
foreach ($links as $key => &$link_array) {
// ACTIVE CHECK
if ($check_active && isset($default_dashboard_settings[$link_array['path']]['active']) && $default_dashboard_settings[$link_array['path']]['active'] == FALSE) {
unset($links[$key]);
continue;
}
// MODULE EXIST CHECK
if (isset($link_array['destination_module']) && !module_exists($link_array['destination_module'])) {
unset($links[$key]);
continue;
}
// ACCESS CHECK
if (!drupal_valid_path($link_array['path'])) {
unset($links[$key]);
}
if (isset($default_dashboard_settings[$link_array['path']]['weight'])) {
$link_array['weight'] = $default_dashboard_settings[$link_array['path']]['weight'];
}
elseif (!isset($link_array['weight'])) {
$link_array['weight'] = $weight;
$weight++;
}
}
// HOOK FOR ALTERING LINKS
drupal_alter('pm_dashboard_links', $links, $type);
// SORT LINKS BY WEIGHT
uasort($links, '_pm_dashboard_sort_links');
}
return $links;
}