0

In custom module names supply_area I've created custom path.

function supply_area_menu() {
    $items['supply-area'] = array(
        'title' => 'Supply area',
        'page callback' => 'supply_area_page',
        'type' => MENU_NORMAL_ITEM,
        'access callback' => true,
        'menu_name' => 'main-menu',
    );
    return $items;
}

Everything works perfectly except that even if I assign this path into main menu structure it does not hold menu structure so breadcrumbs looks like: Home > Supply area and not Home > About > Supply area. Is there something wrong with my hook_menu?

2
  • Given just the above code, why would you presume it should know about "About" ? – Jimajamma Mar 25 '14 at 14:11
  • It's normal menu item so I think I could add this path to main menu. If it's in main menu in Home | About | Supply area so it should hold active trail? – Filip Górczyński Mar 25 '14 at 14:15
0

I am not sure what you are doing in a lot more areas of your system than described above, but doing the following on a d7 testbed here:

function MYMODULE_menu() {

  array $items;

  $items['about'] = array(
    'title' => 'About',
    'page callback' => 'MYMODULE_about_page',
    'type' => MENU_NORMAL_ITEM,
    'access callback' => TRUE,
    'menu_name' => 'main-menu',
  );

  $items['supply-area'] = array(
    'title' => 'Supply area',
    'page callback' => 'MYMODULE_supply_area_page',
    'type' => MENU_NORMAL_ITEM,
    'access callback' => TRUE,
    'menu_name' => 'main-menu',
  );

  return $items;

}

function MYMODULE_about_page() {
  return 'What\'s it all about, Alfie?';
}

function MYMODULE_supply_area_page() {
  return 'Making Supplies';
}

...followed by clearing caches and then setting it up via the Menu UI:

enter image description here

...provides the following:

enter image description here

so I would check how you might be doing it slightly differently on your system.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.