function og_subgroups_menu in Subgroups for Organic groups 5.3
Same name and namespace in other branches
- 5.4 og_subgroups.module \og_subgroups_menu()
- 5 og_subgroups.module \og_subgroups_menu()
- 6 og_subgroups.module \og_subgroups_menu()
@file Maintains a hierarchy of group/subgroup relationships.
File
- ./
og_subgroups.module, line 7 - Maintains a hierarchy of group/subgroup relationships.
Code
function og_subgroups_menu($may_cache) {
$items = array();
if (!$may_cache) {
$arg0 = arg(0);
$arg1 = arg(1);
if ($arg0 == 'node' && is_numeric($arg1)) {
$node = node_load($arg1);
if (og_is_group_type($node->type)) {
//Begin tabs displayed on node view.
if (user_access('access og_subgroups node view tabs')) {
$items[] = array(
'path' => 'node/' . $arg1 . '/view/nodes',
'title' => t('Overview'),
'access' => node_access('view', $node),
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => 0,
);
$items[] = array(
'path' => 'node/' . $arg1 . '/view/tree',
'title' => t('Tree'),
'callback' => 'og_subgroups_page',
'callback arguments' => $arg1,
'access' => node_access('view', $node),
'type' => MENU_LOCAL_TASK,
'weight' => 5,
);
if (_og_subgroups_can_view_members($arg1)) {
$items[] = array(
'path' => 'node/' . $arg1 . '/view/members',
'title' => t('Members'),
'callback' => 'og_subgroups_members_page',
'callback arguments' => $arg1,
'access' => node_access('view', $node),
'type' => MENU_LOCAL_TASK,
'weight' => 7,
);
}
}
//End of tabs displayed on node view.
$items[] = array(
'path' => 'node/' . $arg1 . '/edit/group',
'title' => t('Group'),
'access' => node_access('update', $node),
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items[] = array(
'path' => 'node/' . $arg1 . '/edit/children',
'title' => t('SubGroups'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'og_subgroups_edit_children_page',
$arg1,
),
'access' => user_access('edit subgroups hierarchy'),
'type' => MENU_LOCAL_TASK,
'weight' => 3,
);
$items[] = array(
'path' => 'node/' . $arg1 . '/edit/members',
'title' => t('Members'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'og_subgroups_edit_members_page',
$arg1,
),
'access' => user_access('edit subgroups members'),
'type' => MENU_LOCAL_TASK,
'weight' => 5,
);
}
}
}
else {
$items[] = array(
'path' => 'admin/og/subgroups',
'title' => t('OG Subgroups Settings'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'og_subgroups_settings',
),
'access' => user_access('administer og_subgroups'),
'weight' => 1,
);
}
return $items;
}