function pm_dashboard_get_links in Drupal PM (Project Management) 7.2
Same name and namespace in other branches
- 8 pm.module \pm_dashboard_get_links()
- 7.3 pm.module \pm_dashboard_get_links()
- 7 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 154 - 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;
}