Now that menu phase 1 is basically done at http://drupal.org/node/34755 how we proceed?
Phase 2 will see some new fields, mid (for menu id), pid (for parent id), parents (comma separated list ids of all parents), menu_link, task, visible and finally, display_order. menu_link is the aliased and themed menu link. task and visible are flags which tells us what their name suggest. display_order will provide, well the display order, based on vancoding. All this means that one relatively simple query
SELECT menu_link FROM menu WHERE pid IN $parents AND visible = 1 AND task = 0 ORDER BY display_order will be able to select the whole visible tree. $parents will be initialized to the parents of the current menu item and in phase 2 that's it. But in phase 3, as we create the menu tree we will check for expanded items and add them to parents and redo the menu tree. This means some slowdown especially if expanded is used in depth, but I can not care less -- for some time, I thought I will not even do expanded.
Another similar query will be able to select tasks. Here the display will be slower because % signs need replacement and because of that we can't store the menu_link ahead of time. This is less of a problem because usually we have much fewer tasks than menu items.
For phase 3, first we need to realize that the menu module does two things which UI look alike but for our system they are vastly different. One of them is editing menu items already defined. The other is adding (and editing) additional items. At this point I think they will use two tables and even two hooks to add this to the menu sytem. The first will use hook_menu_alter to change title, visible parent, description and weight based on its table. The second will likely use a new hook to add new items to the menu table. If we do not want to find ourselves in the same corner as we are now then this facility will not use unique paths, so it will become possible to add two visible links to the same path. Also, this new, yet unnamed hook will make it possible to add items to a non-navigation menu: you define your item as a MENU_CALLBACK in hook_menu and here you add a visible link to whatever menu you desire.
Commenting on this Story is closed.