Can I combine Views page tabs with module generated tabs?
I have created a View with multiple page displays. I have specified one as the "default tab" and the other two as "tab" and they all display c开发者_如何学Pythonorrectly together on a page similar to this:
I would like to be able to insert another tab onto this page with module generated code (not from a view). Is this possible?
Using the menu hook you can define another tab for the page similar to below:
function MODULENAME_menu() {
$items = array();
$items['PATH_TO_VIEW_DEFAULT_TAB/YOUR_NEW_TAB'] = array(
'title' => 'TAB TITLE',
'page callback' => 'FUNCTION NAME',
'page arguments' => array('ACCESS ARGUMENT'),
'access callback' => 'user_access',
'access arguments' => array('ACCESS ARGUMENT'),
'type' => MENU_LOCAL_TASK,
'weight' => 10
);
return $items;
}
精彩评论