I have different page layouts based on how deep a page is in a menu trail. My primary menu is setup as such:

Primary Menu
- Item 1
- Item 2
-- Sub Item 1
-- Sub Item 2
- Item 3

I'd like to use a context for the first level of the menu, and have a different one for the second level. I'd like to do this without specifying the individual pages themselves... is this possible?

CommentFileSizeAuthor
#2 npcontexts.tgz1.19 KBauberdjinn
#1 npcontexts.tar_.gz1.19 KBauberdjinn

Comments

auberdjinn’s picture

StatusFileSize
new1.19 KB

I think the only way to do this is to define a new condition in a plugin. At least I hope it is because that's what I've just done. I've created a custom module to do this for the site I'm working on and have attached it. Maybe you could give it a go and if it works for you I could work it up into a proper module or a patch for Context, whichever is more appropriate.

I may well have done this horribly - have just muddled through to work out how to put a plugin together. But it's a start!

auberdjinn’s picture

StatusFileSize
new1.19 KB

Oops, sorry, named the file properly this time!

bkosborne’s picture

Ahh I'll check it out this weekend. It would be great to get this integrated with the menu condition though.

If I can assign a context to a menu "level", it would be so great. Most of the sites I build out have primary, secondary, and tertiary page templates.

jumpfightgo’s picture

This won't solve every use case, but another option is to use the cep_immediate_taxonomy_child module of the "Context Extras" module, which lets you select terms whose children activate the context.

http://drupal.org/project/context_extras