开发者

Drupal: Horizontal Menu

开发者 https://www.devze.com 2023-02-19 08:14 出处:网络
I\'m trying to programmatically create the custom horizontal menu for my custom module, but I\'m having a lot of trouble.

I'm trying to programmatically create the custom horizontal menu for my custom module, but I'm having a lot of trouble.

I want to make a horizontal menu like this :

Drupal: Horizontal Menu

This is my code so far, but it only displays on the main left vertical sidebar with everything else (this is the pre-packaged Garland theme):

/* hook_menu implementation for my 'lab' custom module */
function lab_menu() { 
  $items = array(); 
  $items['lab/admin'] = array( 
    'title' => 'LAB Admin',
    'page callback' => 'some_method',
    'access arguments' => array('access content'),
    'access callback' => 'user_access',
    'type' => MENU_NORMAL_ITEM,
   );      
  /* should appear as a 'tabbed' horizontal method */ 
  $items['lab/admin/appoint'] = array(
    'title' => 'LAB: Appointment',
    'page callback' => 'some_method',
    'page arguments' => array(1),
    'access callback' => 'node_access',
    'access arguments' => array('view', 1),
 开发者_Python百科   'type' => MENU_NORMAL_ITEM,
  );
  $items['lab/admin/reviewers'] = array(
    'title' => 'Reviewer\'s Link',
    'page callback' => 'some_method',
    'page arguments' => array(1),
    'access callback' => 'node_access',
    'access arguments' => array('view', 1),
    'type' => MENU_NORMAL_ITEM,
  );
  return $items;
}


Tabs like these are shown on user pages, nodes, etc.

To create a "tabs" menu like shown in the picture above in your custom module, use 'type' => MENU_LOCAL_TASK to define it as a tab on a page.

To create a second level of tabs, use a combination of 'type' => MENU_LOCAL_TASK and 'type' => MENU_DEFAULT_LOCAL_TASK

0

精彩评论

暂无评论...
验证码 换一张
取 消