Drupal 6 Drupal 6:在菜单项上添加子菜单项?

Drupal 6 Drupal 6:在菜单项上添加子菜单项?,drupal-6,Drupal 6,我有一个钩子: function node_field_link_menu() { $items['order_food'] = array( 'title' => 'Products', 'page callback' => 'node_field_link_products_page', 'access callback' => TRUE, 'menu_name' => 'primary-lin

我有一个钩子:

function node_field_link_menu() 
{
    $items['order_food'] = array(
        'title' => 'Products',
        'page callback' => 'node_field_link_products_page',
        'access callback' => TRUE,
        'menu_name' => 'primary-links',  
        'type' => MENU_NORMAL_ITEM,
    );
  return $items;
}
这是我的菜单,我很满意。问题是,我希望此菜单项下有项目,因此我最终得到:

- Products
   - Product 1
   - Product 2
   - Product 3
   - Product 4
我读到可以使用“plid”,但问题是,在这种情况下,我不知道plid是什么,因为我刚刚创建了父级。所以我不能这么做:

function node_field_link_menu() 
{
    $items['order_food/procuct1'] = array(
        'title' => 'Product 1',
        'page callback' => 'node_field_link_products_page1',
        'access callback' => TRUE,
        'menu_name' => 'primary-links',  
        'type' => MENU_NORMAL_ITEM,
        'plid' => XXX?,
    );
  return $items;
}

那么,如何在我在Drupal 6中创建的菜单项下添加另一个菜单项呢?

如果没有“plid”,您所做的应该可以工作。Drupal可以识别路径模式并为您完成这项工作。也就是说,如果您有一条“order\u food”路径和一条“order\u food/product1”路径,product1将是“order\u food”的子级。 创建菜单后,您需要做的就是清除Drupal的缓存

刚刚在一个新的Drupal 6实例上试用了它,清除了缓存,我看到它在工作:

$items['order_food'] = array(
    'title' => 'Product',
    'page callback' => 'node_field_link_products_page',
    'access callback' => TRUE,
    'menu_name' => 'primary-links',
    'type' => MENU_NORMAL_ITEM,
);
$items['order_food/product1'] = array(
    'title' => 'Product1',
    'page callback' => 'node_field_link_products_page1',
    'access callback' => TRUE,
    'menu_name' => 'primary-links',
    'type' => MENU_NORMAL_ITEM,
);
打开“admin/build/menu customize/primary links”的URL会将Product1显示为Product的子级