function og_panels_menu in Organic groups 6
Same name and namespace in other branches
- 5.8 og_panels.module \og_panels_menu()
- 5 og_panels.module \og_panels_menu()
- 5.3 og_panels.module \og_panels_menu()
- 5.7 og_panels.module \og_panels_menu()
File
- modules/
og_panels/ og_panels.module, line 12
Code
function og_panels_menu($may_cache) {
if ($may_cache) {
$items[] = array(
'path' => 'admin/og/og_panels',
'title' => 'Organic groups panels',
'description' => 'Configure the content that is available to group admins when creating group pages.',
'callback' => 'og_panels_admin_content',
'access' => user_access('administer organic groups'),
);
}
else {
if (arg(0) == 'node' && is_numeric(arg(1))) {
$node = node_load(arg(1));
if (og_is_group_type($node->type) && node_access('view', $node)) {
$nid = arg(1);
$items[] = array(
'path' => "node/{$nid}/og_panels",
'title' => 'Pages',
'callback' => 'og_panels_overview',
'callback arguments' => array(
$node,
),
'access' => og_is_group_admin($node) && user_access('manage OG panels pages'),
'type' => MENU_LOCAL_TASK,
'weight' => 8,
);
$items[] = array(
'path' => "node/{$nid}/og_panels/list",
'title' => 'List',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
$items[] = array(
'path' => "node/{$nid}/og_panels/form",
'callback' => 'drupal_get_form',
'callback arguments' => array(
'og_panels_form',
$node,
),
'title' => arg(4) ? 'Edit page' : 'Add new page',
'type' => MENU_LOCAL_TASK,
'weight' => 0,
);
$displays = og_panels_get_all($node->nid);
foreach ($displays as $display) {
if ($display->default_page && $display->published && arg(2) != 'feed') {
// Hijack the menu handler for this node.
$items[] = array(
'path' => "node/{$nid}",
'title' => $node->title,
// doesn't work
'callback' => 'og_panels_page',
'callback arguments' => array(
$display->did,
$node,
$node->title,
),
);
/*
* Optional. Horrible hack since the tab title is not changeable in D5. Add the following code
* to your theme's template.php in the _phptemplate_variables('page') section.
* if (isset($GLOBALS['og_panels_view_tab_fix'])) {
* $variables['tabs'] = str_replace('>View<', '>'. $GLOBALS['og_panels_view_tab_fix']. '<', $variables['tabs']);
* }
*/
$GLOBALS['og_panels_view_tab_fix'] = check_plain($display->page_title);
}
else {
$items[] = array(
'path' => "node/{$nid}/{$display->path}",
'title' => $display->page_title,
'callback' => 'og_panels_page',
// have to pass all these args so the args are known in panels_page()
'callback arguments' => array(
$display->did,
$node,
$display->page_title,
),
'type' => MENU_LOCAL_TASK,
'access' => $display->published || og_is_group_admin($node) && user_access('manage OG panels pages'),
'weight' => $display->weight,
);
}
}
$items[] = array(
'path' => "node/{$nid}/og_panels/" . arg(3) . '/view',
'callback' => 'og_panels_page',
'callback arguments' => array(
arg(3),
$node,
),
'type' => MENU_CALLBACK,
);
if (is_numeric(arg(3))) {
$items[] = array(
'path' => "node/{$nid}/og_panels/" . arg(3) . '/panel_layout',
'callback' => 'og_panels_edit_layout',
'callback arguments' => array(
arg(3),
$node,
),
'type' => MENU_CALLBACK,
);
$items[] = array(
'path' => "node/{$nid}/og_panels/" . arg(3) . '/panel_settings',
'callback' => 'og_panels_edit_layout_settings',
'callback arguments' => array(
arg(3),
$node,
),
'type' => MENU_CALLBACK,
);
$items[] = array(
'path' => "node/{$nid}/og_panels/" . arg(3) . '/panel_content',
'callback' => 'og_panels_edit_content',
'callback arguments' => array(
arg(3),
$node,
),
'type' => MENU_CALLBACK,
);
$items[] = array(
'path' => "node/{$nid}/og_panels/" . arg(3) . '/delete',
'title' => 'Delete',
'callback' => 'drupal_get_form',
'callback arguments' => array(
'og_panels_delete_confirm',
arg(3),
$node,
),
'type' => MENU_CALLBACK,
);
}
}
}
}
return $items;
}