【发布时间】:2019-01-18 20:17:34
【问题描述】:
一旦您通过单击子菜单请求页面,我想隐藏子菜单项的路径,该路径显示在面包屑中。
这是我用来创建一个菜单项和三个子菜单项的代码:
$items['what-to-expect'] = array(
'title' => t('What To Expect'),
'page callback' => 'pvmf_layout_what_to_expect',
'access arguments' => array('access content'),
'menu_name' => 'main-menu',
'type' => MENU_NORMAL_ITEM,
'weight' => 1,
'expanded' => TRUE
);
$items['what-to-expect/0'] = array(
'title' => t('Local Event'),
'page callback' => 'pvmf_layout_what_to_expect_0',
'access arguments' => array('access content'),
'type' => MENU_NORMAL_ITEM,
'weight' => 0
);
$items['what-to-expect/1'] = array(
'title' => t('Online Event'),
'page callback' => 'pvmf_layout_what_to_expect_1',
'access arguments' => array('access content'),
'type' => MENU_NORMAL_ITEM,
'weight' => 1
);
$items['what-to-expect/2'] = array(
'title' => t('ONE Presenters'),
'page callback' => 'pvmf_layout_what_to_expect_2',
'access arguments' => array('access content'),
'type' => MENU_NORMAL_ITEM,
'weight' => 2
);
在我更改定义中的type 后,我得到的代码是:
$items['what-to-expect'] = array(
'title' => t('What To Expect'),
'page callback' => 'pvmf_layout_what_to_expect',
'access arguments' => array('access content'),
'menu_name' => 'main-menu',
'type' => MENU_VISIBLE_IN_TREE,
'weight' => 1,
'expanded' => TRUE
);
$items['what-to-expect/0'] = array(
'title' => t('Local Event'),
'page callback' => 'pvmf_layout_what_to_expect_0',
'access arguments' => array('access content'),
'type' => MENU_VISIBLE_IN_TREE,
'weight' => 0
);
$items['what-to-expect/1'] = array(
'title' => t('Online Event'),
'page callback' => 'pvmf_layout_what_to_expect_1',
'access arguments' => array('access content'),
'type' => MENU_VISIBLE_IN_TREE,
'weight' => 1
);
$items['what-to-expect/2'] = array(
'title' => t('ONE Presenters'),
'page callback' => 'pvmf_layout_what_to_expect_2',
'access arguments' => array('access content'),
'type' => MENU_VISIBLE_IN_TREE,
'weight' => 2
);
但面包屑仍然会继续显示。我试图通过转到Configuration -> Performance 来清除缓存,但它没有帮助。我可能会错过什么?
我检查了menu.inc 实际上包含:
/**
* Menu type -- A "normal" menu item that's shown in menu and breadcrumbs.
*
* Normal menu items show up in the menu tree and can be moved/hidden by
* the administrator. Use this for most menu items. It is the default value if
* no menu item type is specified.
*/
define('MENU_NORMAL_ITEM', MENU_VISIBLE_IN_TREE | MENU_VISIBLE_IN_BREADCRUMB);
【问题讨论】:
标签: php drupal drop-down-menu drupal-7 hook-menu