Using views I can create a page with the nid as context and place a primary tab alongside the "View" and "Edit" tab on a node. How can I move it to the seconday tab on the "View" page?
e.g. What I can get
What I need
Try adding a View page with path
node/%/view/secondary-task
Make it a "Default task" or "Default menu tab" in the View menu settings.
It is not possible, as the menu structure is missing a menu item.
I have altered a default view the Views module to be visible on node/%/view/backlinks, instead of node/%/backlink; I also changed its menu type to menu tab for an existing menu. The view was not shown.
I then added the following code in my test module.
function code_testing_menu_alter(&$items) {
$items['node/%node/view/view'] = array(
'title' => 'View',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
}
function code_testing_module_implements_alter(&$implementations, $hook) {
if ($hook == 'menu_alter') {
$group = $implementations['code_testing'];
unset($implementations['code_testing']);
$implementations['code_testing'] = $group;
}
}
Once I did that, the view was correctly rendered as sub-tab.
In short, showing a view as sub-tab is possible, if there is already a sub-tab. Differently, the view will not be visible.