Hi,
me_theme_registry_alter implements regstry alter that forces drupal theming layer to use me module theme_menu_item_link function. Why exactly is that? This breaks any theme that implements it's own theme_menu_item_link function
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | me.menu_item_link.big_.patch | 3.35 KB | donquixote |
| #6 | me.menu_item_link.small_.patch | 2.55 KB | donquixote |
| #5 | me.menu_item_link.small_.patch | 1.75 KB | donquixote |
| #5 | me.menu_item_link.big_.patch | 2.59 KB | donquixote |
Comments
Comment #1
hefox commentedContext does similair, but it checks who is currently controlling the theme and doesn't touch it if the theme is using it, I'd suggest the same.
Comment #2
donquixote commentedme.module now does this in me_theme_menu_item_link(),
see the patch in #419082: Seems to break DHTML Menu.
This is nice, but there are a few problems:
1. Multiple themes on one site (with sections or context).
me_variable_get('me_theme_menu_item_link')-> this will always return the function for the default site theme, even when the current page has a different theme.
2. Theme inheritance.
function_exists($GLOBALS['custom_theme'] .'_menu_item_link')-> This does not check for base theme implementations.
I'm currently thinking about how this can be fixed, without breaking other modules' theme_registry_alter(). Not so easy.
Comment #3
donquixote commentedHere is the solution (will correct when I find bugs).
and
And yes, I am too lazy for a real patch (again) ..
Comment #4
donquixote commentedThe important parts:
- There is more than one theme registry: One for every theme.
- Instead of the variable_set / variable_get, we can store the value in the theme registry itself. We attempt to use a unique key ("me_original_function"), to avoid name collisions.
- We check for parent themes, in addition to the active theme.
Comment #5
donquixote commentedI noticed that the fallback logic has been removed, so I produced two patches: One with the fallback code ("big"), and one without ("small").
Comment #6
donquixote commentedI think I was looking at the wrong module version.
Here are the same patches against 2.x-dev.
I think "big" is the one we need.
Comment #7
donquixote commentedComment #8
donquixote commentedAny chance of getting this in?
It is quite unconvenient having to maintain a patched module.
Comment #9
nohup commentedcommitted to git and released, thanks donquixote.
Comment #10
donquixote commentedThanks!
Which version did you choose?
(it's some time ago, I don't really remember what is the difference)
Comment #11
nohup commented6.x-2.x dev the release is 6.x-2.8. I goofed up the git commit settings so it won't show up in my commit stream but the code is there.
Comment #12
donquixote commentedYeah, my question was rather, which version of the patch.
Comment #13
nohup commented"big"