5

I have a hook:

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;
}

This gives me my menu item and I'm happy with it. The problem is, I want items UNDER this menu item, so I end up with:

- Products
   - Product 1
   - Product 2
   - Product 3
   - Product 4

I read that you can use "plid", but the problem is, in this context, I don't know what the PLID is, because I just created the parent. So I can't do this:

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;
}

So how can I add another menu item below a menu item I created in Drupal 6?

rockstardev
  • 13,479
  • 39
  • 164
  • 296

1 Answers1

0

What you did should work without the 'plid'. Drupal recognizes the path pattern and does the job for you. Meaning, if you have a path of 'order_food' and a path of 'order_food/product1', product1 will be the child of 'order_food'. All you need to do after creating the menu is to clear Drupal's cache.

Just tried it on a new Drupal 6 instance, cleared the cache and I see it working:

$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,
);

Opening the URL of "admin/build/menu-customize/primary-links" will show the Product1 as a child of Product.

David
  • 2,528
  • 1
  • 23
  • 29