I'm trying to render nodes with a custom view mode, having another tab for each node in the same place than "Edit", "View", etc. So I have declared my custom view mode with hook_entity_info_alter, my new "tab" with hook_menu, with a page_callback pointing to a custom function that should return the node according to my custom view node. It works great, but the node title is rendered too. How can I remove the node title ? Here is the code. Thanks!
/**
* Implements hook_entity_info_alter().
*/
function test_custom_view_mode_entity_info_alter(&$entity_info) {
$entity_info['node']['view modes']['another_teaser'] = array(
'label' => t('Another teaser'),
'custom settings' => TRUE,
);
}
/**
* Implements hook_menu().
*/
function test_custom_view_mode_menu()
{ $items['node/%node/another-teaser'] = array(
'title' => 'Another Teaser',
'page callback' => '_test_custom_view_mode_display_content',
'page arguments' => array(1),
'access arguments' => array('access content'),
'type' => MENU_LOCAL_TASK,
);
return $items;
}
/**
* Custom page callback hook_menu().
*/
function _test_custom_view_mode_display_content($node) {
$node_viewed = node_view(node_load($node->nid), 'another_teaser');
return array(
'content' => array(
'node' => $node_viewed,
),
);
}
if($vars['view_mode'] == 'another_teaser') { $vars['title'] = ''; }