Skip to main content
replaced http://drupal.stackexchange.com/ with https://drupal.stackexchange.com/
Source Link

I am trying to create a menu using code in D7 (see my related questionsee my related question) and have found that these two Drupal API functions have different arrays for the $item variable. My intent is to create a three level menu hierarchy but with all of the associated paths being the same format /name/%/something so that I can use views to refine the content. In hook menu, the parents are defined using the Path name (eg. parent/child/something). In menu_save_link, the hierarchy appears to be established using the pid array value in $item. Hook_menu is called when my custom module is read by drupal and the menu links are established. What I am wondering is if menu_link_save, could be used to do the same thing but with the same path style for all links, rather than a parent-child pattern?

I have been trying to trace the logic between the two functions in the API, but have not found the link between them. My thinking is that menu_link_saveis used by hook_menu after some preprocessing and that I might be able to define a uniform paths and establish the hierarchy through the pid. Failing that, is there another way to alter the paths and preserve the hierarchy?

I am trying to create a menu using code in D7 (see my related question) and have found that these two Drupal API functions have different arrays for the $item variable. My intent is to create a three level menu hierarchy but with all of the associated paths being the same format /name/%/something so that I can use views to refine the content. In hook menu, the parents are defined using the Path name (eg. parent/child/something). In menu_save_link, the hierarchy appears to be established using the pid array value in $item. Hook_menu is called when my custom module is read by drupal and the menu links are established. What I am wondering is if menu_link_save, could be used to do the same thing but with the same path style for all links, rather than a parent-child pattern?

I have been trying to trace the logic between the two functions in the API, but have not found the link between them. My thinking is that menu_link_saveis used by hook_menu after some preprocessing and that I might be able to define a uniform paths and establish the hierarchy through the pid. Failing that, is there another way to alter the paths and preserve the hierarchy?

I am trying to create a menu using code in D7 (see my related question) and have found that these two Drupal API functions have different arrays for the $item variable. My intent is to create a three level menu hierarchy but with all of the associated paths being the same format /name/%/something so that I can use views to refine the content. In hook menu, the parents are defined using the Path name (eg. parent/child/something). In menu_save_link, the hierarchy appears to be established using the pid array value in $item. Hook_menu is called when my custom module is read by drupal and the menu links are established. What I am wondering is if menu_link_save, could be used to do the same thing but with the same path style for all links, rather than a parent-child pattern?

I have been trying to trace the logic between the two functions in the API, but have not found the link between them. My thinking is that menu_link_saveis used by hook_menu after some preprocessing and that I might be able to define a uniform paths and establish the hierarchy through the pid. Failing that, is there another way to alter the paths and preserve the hierarchy?

Rollback to Revision 3
Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

Drupal Coding D7 - Menus - What is the relationship between hook menu() and menu_link_save()?

edited title
Link
Ashlar
  • 5.1k
  • 6
  • 35
  • 56

Drupal Coding D7 - Menus - What is the relationship between hook menu() and menu_link_save()?

edited title
Link
Ashlar
  • 5.1k
  • 6
  • 35
  • 56
Loading
Tweeted twitter.com/#!/StackDrupal/status/177541755854532608
Source Link
Ashlar
  • 5.1k
  • 6
  • 35
  • 56
Loading