function ggroup_menu_local_tasks_alter in Group 7
Implements hook_menu_local_tasks_alter().
Adds subgroup creation local tasks to group/%group.
File
- modules/
ggroup/ ggroup.router.inc, line 42 - Contains all router functions for the Subgroup module.
Code
function ggroup_menu_local_tasks_alter(&$data, $router_item, $root_path) {
// Add action links for subgroup creation on group/%group.
if ($root_path == 'group/%') {
$gid = $router_item['original_map'][1];
// Set local actions for creating subgroups.
foreach (group_types() as $group_type => $info) {
$item = menu_get_item("group/{$gid}/subgroup/add/{$group_type}");
// Add one general and one unique class for styling purposes.
$item['localized_options']['attributes']['class'][] = 'group-local-action';
$item['localized_options']['attributes']['class'][] = 'group-local-action-' . str_replace('_', '-', $group_type);
// Add another class to target just Subgroup local actions.
$item['localized_options']['attributes']['class'][] = 'ggroup-local-action';
if ($item['access']) {
$data['actions']['output'][] = array(
'#theme' => 'menu_local_action',
'#link' => $item,
);
}
}
}
}