function publishcontent_menu in Publish Content 5
Same name and namespace in other branches
- 5.2 publishcontent.module \publishcontent_menu()
- 6 publishcontent.module \publishcontent_menu()
- 7 publishcontent.module \publishcontent_menu()
Implementation of hook_menu().
See also
File
- ./
publishcontent.module, line 14 - Add button to publish or unpublish a node, with access control based on the node type
Code
function publishcontent_menu($may_cache) {
$items = array();
if (!$may_cache && arg(0) == 'node' && is_numeric(arg(1))) {
$node = node_load(arg(1));
if ($node->nid && (user_access('un/publish ' . check_plain($node->type) . ' content') || user_access('un/publish *all* content'))) {
$items[] = array(
'path' => 'node/' . arg(1) . '/' . ($node->status ? 'unpublish' : 'publish'),
'title' => t($node->status ? 'Unpublish' : 'Publish'),
'callback' => 'publishcontent_toggle_status',
'callback arguments' => array(
$node,
),
'access' => TRUE,
'weight' => 5,
'type' => MENU_LOCAL_TASK,
);
// force the access to the node
if (!user_access('administer nodes')) {
$items[] = array(
'path' => 'node/' . arg(1),
'title' => t('View'),
'callback' => 'node_page_view',
'callback arguments' => array(
$node,
),
'access' => TRUE,
'type' => MENU_CALLBACK,
);
}
}
}
return $items;
}