1

我有一个页面,其中包含通过 hook_menu 和 MENU_LOCAL_TASK 呈现的多个选项卡。每当我单击选项卡时,内容区域中的页面标题都会更改为“主页”。如何将其设置为留在“我的设置”?

这是我的代码:

 $items['settings'] = array(
'title' => 'My Settings',
'page callback' => 'drupal_get_form',
'page arguments' => array('settings_page_form'),
'access arguments' => array('access content'),
'file' => 'settings.inc',
'file path' => drupal_get_path('module','mymodule') . '/includes',
'type' => MENU_CALLBACK,
'access callback' => TRUE, );

 $items['settings/account'] = array(
'title' => 'Account Settings',
'title_callback' => $items['settings']['title'],     
'type' => MENU_DEFAULT_LOCAL_TASK,
 'weight' => -3,   );


 $items['settings/layout'] = array(
'title' => 'Page Layout',
'title_callback' => $items['settings']['title'],
'page callback' => 'drupal_get_form',
'page arguments' => array('settings_layout_form'),
'access arguments' => array('access content'),
'file' => 'settings.inc',
'file path' => drupal_get_path('module','mymodule') . '/includes',
'type' => MENU_LOCAL_TASK,
 'weight' => -2,   ); 

 $items['settings/shopping'] = array(
'title' => 'Shopping Preferences',
'title_callback' => $item['settings']['title'],
'page callback' => 'drupal_get_form',
'page arguments' => array('settings_shopping_form'),
'access arguments' => array('access content'),
'file' => 'settings.inc',
'file path' => drupal_get_path('module','mymodule') . '/includes',
'type' => MENU_LOCAL_TASK,
 'weight' => -1,

);

4

1 回答 1

0

我只是使用 drupal_set_title 来设置页面的页面标题。似乎这是设计使然,允许标签设置自己的标题。

http://drupal.org/node/1699560

于 2012-10-01T23:10:40.653 回答