I'm trying to create tab in node display that links to node delete form. I used hook_menu_local_tasks_alter in template.php
function mytheme_menu_local_tasks_alter(&$data, $router_item, $root_path) {
// Add a tab linking to node/add to all pages.
$data ['tabs'][0]['output'][] = array(
'#theme' => 'menu_local_task',
'#link' => array(
'title' => t('Delete'),
'tab_parent' => 'node/%',
'tab_root' => 'node/%',
'tab_root_href' => 'node/'.arg(1),
'tab_parent_href' => 'node/'.arg(1),
'href' => 'node/'.arg(1).'/delete',
'access callback' => 'node_access',
'access arguments' => array('delete', 1),
'localized_options' => array(
'attributes' => array(
'title' => t('Delete'),
),
),
),
);
}
Tab is created but it is displayed for every user and on every page where tabs are enabled. How can I configure access arguments
to display tab only on node display page and only for user with permissions [Content type]: delete own content
?