Two tiered menus in D7 when the top level is user specific
I'm looking into a two tiered menu in a D7 application where the second level of the menu is standard, but the top level is different for every user. To make this concrete, suppose the user is a teacher at a school where the teacher uses multiple rooms, and needs to order materials for each room separately. Each teacher has a separate list of rooms, but the the pages we track -- class lists, crafts inventory, furniture... are the same for each room. So for teacher A, we might have a set of menus like this: * Room 220 o Class List o Crafts Inventory o Furniture * Room 221 o Class List o Crafts Inventory o Furniture and so on. It's clear to me how to do a loader function and menu handler for a link like 'teacher/%teacher/room/%/class_list', but I don't see how to populate the level of the menus for '220' and '221' in the 3 position. In Drupal 5, I used to use the !$may_cache argument for these sorts of things. I'm not arguing that this was efficient, but it did work. What hooks would I need to use in addition to hook_menu to make this work in Drupal 7? Thanks, Rob Thorne Torenware Networks
This looks like another case of Menu Block with an alter hook to prepend the parent items per user. On Mar 21, 2011, at 8:55 PM, Rob Thorne <rob@torenware.com> wrote:
I'm looking into a two tiered menu in a D7 application where the second level of the menu is standard, but the top level is different for every user.
To make this concrete, suppose the user is a teacher at a school where the teacher uses multiple rooms, and needs to order materials for each room separately. Each teacher has a separate list of rooms, but the the pages we track -- class lists, crafts inventory, furniture... are the same for each room.
So for teacher A, we might have a set of menus like this:
* Room 220 o Class List o Crafts Inventory o Furniture * Room 221 o Class List o Crafts Inventory o Furniture
and so on. It's clear to me how to do a loader function and menu handler for a link like 'teacher/%teacher/room/%/class_list', but I don't see how to populate the level of the menus for '220' and '221' in the 3 position.
In Drupal 5, I used to use the !$may_cache argument for these sorts of things. I'm not arguing that this was efficient, but it did work. What hooks would I need to use in addition to hook_menu to make this work in Drupal 7?
Thanks, Rob Thorne Torenware Networks
Ken, My guess is this is probably what I want. Do you have a link to an example of what you mean exactly? I've looked at the API that Menu Block exports, but it isn't clear when it calls its hooks, or which alter hook I'd need to implement to modify its behavior. Thanks, Rob On 03/21/2011 07:26 PM, Ken Rickard wrote:
This looks like another case of Menu Block with an alter hook to prepend the parent items per user.
On Mar 21, 2011, at 8:55 PM, Rob Thorne <rob@torenware.com> wrote:
I'm looking into a two tiered menu in a D7 application where the second level of the menu is standard, but the top level is different for every user.
To make this concrete, suppose the user is a teacher at a school where the teacher uses multiple rooms, and needs to order materials for each room separately. Each teacher has a separate list of rooms, but the the pages we track -- class lists, crafts inventory, furniture... are the same for each room.
So for teacher A, we might have a set of menus like this:
* Room 220 o Class List o Crafts Inventory o Furniture * Room 221 o Class List o Crafts Inventory o Furniture
and so on. It's clear to me how to do a loader function and menu handler for a link like 'teacher/%teacher/room/%/class_list', but I don't see how to populate the level of the menus for '220' and '221' in the 3 position.
In Drupal 5, I used to use the !$may_cache argument for these sorts of things. I'm not arguing that this was efficient, but it did work. What hooks would I need to use in addition to hook_menu to make this work in Drupal 7?
Thanks, Rob Thorne Torenware Networks
Are you dead set on doing this upside down? It might be easier to turn your second level menu into the first level and the rooms into the second level. It might make more sense to the users too. Then rooms can just be permissioned and the menu will work very easily with no mucking around. Nancy Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr. ________________________________ From: Rob Thorne I'm looking into a two tiered menu in a D7 application where the second level of the menu is standard, but the top level is different for every user. To make this concrete, suppose the user is a teacher at a school where the teacher uses multiple rooms, and needs to order materials for each room separately. Each teacher has a separate list of rooms, but the the pages we track -- class lists, crafts inventory, furniture... are the same for each room.
It's not really upside-down for my exact use case, which is actual a financial application -- people actually would want to see their accounts at the top level, and everyone of course has different accounts. Rob On 03/21/2011 08:14 PM, nan wich wrote:
Are you dead set on doing this upside down? It might be easier to turn your second level menu into the first level and the rooms into the second level. It might make more sense to the users too. Then rooms can just be permissioned and the menu will work very easily with no mucking around.
/*Nancy*/
Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
------------------------------------------------------------------------ *From:* Rob Thorne
I'm looking into a two tiered menu in a D7 application where the second level of the menu is standard, but the top level is different for every user.
To make this concrete, suppose the user is a teacher at a school where the teacher uses multiple rooms, and needs to order materials for each room separately. Each teacher has a separate list of rooms, but the the pages we track -- class lists, crafts inventory, furniture... are the same for each room.
Is there a reason that having multiple menus, and controlling their display via context, would not work here? On 3/21/11 5:55 PM, Rob Thorne wrote:
I'm looking into a two tiered menu in a D7 application where the second level of the menu is standard, but the top level is different for every user.
To make this concrete, suppose the user is a teacher at a school where the teacher uses multiple rooms, and needs to order materials for each room separately. Each teacher has a separate list of rooms, but the the pages we track -- class lists, crafts inventory, furniture... are the same for each room.
So for teacher A, we might have a set of menus like this:
* Room 220 o Class List o Crafts Inventory o Furniture * Room 221 o Class List o Crafts Inventory o Furniture
and so on. It's clear to me how to do a loader function and menu handler for a link like 'teacher/%teacher/room/%/class_list', but I don't see how to populate the level of the menus for '220' and '221' in the 3 position.
In Drupal 5, I used to use the !$may_cache argument for these sorts of things. I'm not arguing that this was efficient, but it did work. What hooks would I need to use in addition to hook_menu to make this work in Drupal 7?
Thanks, Rob Thorne Torenware Networks
"controlling their display via context" What do you mean exactly by this? I'm assuming you don't mean a static context here (there'd be far too many if it was one context per room in my example), but a context object in the Context Module / CTools sense of the word. Thanks, Rob On 03/22/2011 07:04 AM, Bill Fitzgerald wrote:
Is there a reason that having multiple menus, and controlling their display via context, would not work here?
On 3/21/11 5:55 PM, Rob Thorne wrote:
I'm looking into a two tiered menu in a D7 application where the second level of the menu is standard, but the top level is different for every user.
To make this concrete, suppose the user is a teacher at a school where the teacher uses multiple rooms, and needs to order materials for each room separately. Each teacher has a separate list of rooms, but the the pages we track -- class lists, crafts inventory, furniture... are the same for each room.
So for teacher A, we might have a set of menus like this:
* Room 220 o Class List o Crafts Inventory o Furniture * Room 221 o Class List o Crafts Inventory o Furniture
and so on. It's clear to me how to do a loader function and menu handler for a link like 'teacher/%teacher/room/%/class_list', but I don't see how to populate the level of the menus for '220' and '221' in the 3 position.
In Drupal 5, I used to use the !$may_cache argument for these sorts of things. I'm not arguing that this was efficient, but it did work. What hooks would I need to use in addition to hook_menu to make this work in Drupal 7?
Thanks, Rob Thorne Torenware Networks
participants (4)
-
Bill Fitzgerald -
Ken Rickard -
nan wich -
Rob Thorne