I always thought that Crumbs can be quite useful for theme switching.
The idea is that the theme chosen for a parent page should be inherited by the child pages, unless these have their own setting.
With crumbs_get_trail() we do have a trail of paths available that does not end at menu items, but goes deep down to node edit pages and friends. If this trail could be used by ThemeKey, this would be cool.
There is one difficulty: ThemeKey does always look at a global context, and this is then cached. This means, in one request we can only ever evaluate the theme for one single path. Generally this will be the current path, unless we want to override $_GET['q'] temporarily.
crumbs_get_trail() is designed to be called in hook_init() if necessary, and it delivers not just paths but also the result of menu_get_item() for each path in the trail. This evaluated router item contains a lot of information that can be used in theme switching rules. For instance, the current node type is already available, ready to be used.
For ThemeKey to work with crumbs, themekey_match_rules() would have to receive the path (and if you like, the evaluated router item) as a parameter, and any static vars such as themekey_get_q::$get_q would have to redesigned so that they allow more than one call to themekey_match_rules().
-----
I don't know if you want to jump on that train, or rather not. There are other possibilities to use the crumbs trail for theme switching, and I will probably try to support more than one of them. I just think that ThemeKey is quite a powerful one, and would match up quite nicely, it it had the above mentioned architectural tweaks.
Btw, see you on bxl2011 !!
Comments
Comment #1
mkalkbrennerI suggest you contact me at bxl2011. Are you sprinting?
Comment #2
donquixote commentedI will probably be sprinting for CiviCRM on Friday, while the others are sprinting for Drupal... But I will have a session about Crumbs on Sunday. I need to get a few things finished on that module, before the session :)
Theme switching is one of the big promises of the crumbs module, and I thought it would be cool to have some perspective that I can present in the session.
So far this perspective is to use crumbs in combination with sections, with a PHP condition. I also considered context with context_reaction_theme. This will all work probably, but in the end I would like to have something that does not require to hack PHP into the database - even if it's just small snippets.
I think I will simply explain ThemeKey as a possible perspective, but for now people have to stick with context and sections.
Just noticed your own session is early in the morning (10:00). This is tough, for a sunday! Although I had the plan that this time I don't want to sac sessions to parties.
Comment #3
donquixote commentedDamn, I did not manage to catch you up :/
Comment #4
donquixote commentedI'm on Drupal Camp Gent 2012 :)
I don't remember much of this issue and the internals of themekey.. but this could change in the next hours, going to use it on a project :)
Comment #5
donquixote commentedHey, it was not so difficult actually :)
(in crumbs.module, going to commit and push soon)
When I created this issue, the idea was to apply every themekey condition to every themekey item.
Now I changed my mind, and instead I just let the admin define one parent path (with wildcard) per themekey rule.
Comment #6
mkalkbrennerCool.
I move this issue to your own issue queue.
Please tell me when you're done with your ThemeKey integration and I'll mention it on the ThemeKey project page.
Comment #7
donquixote commentedThis is long implemented!
Comment #8
donquixote commentedTitle should be adapted to being in the Crumbs issue queue.
Comment #9
mkalkbrennerAnd crumbs is listed on themekey project page since months ... ;-)
Comment #10
donquixote commentedThanks!