You have no idea how much backtracing this took to find!
When creating custom regions as per the handbook They simply DO NOT SHOW UP if dynamicload is active.
This turned out to be because, during the functions dynamicload_menu() -> dynamicload_load()
it attempts to retrieve the list of available regions using system_region_list()
... in order to enumerate the available regions.
That looked like a good idea, but
The problem is threefold.
- The theme has not yet been initialized at this point. Your template.php has not been loaded.
- system_region_list('themename') looks for the themename_regions() function, that is NOT (yet) available, and just returns the default phptemplate_regions. It doesn't try to init it for you.
- system_region_list() caches its result, so that even when the theme gets initialized at its proper time, the list of regions still does not become available!
Meaning no custom regions never!
Pff!
My quick fix is to init the theme properly, although possibly prematurely
function dynamicload_load() {
...
init_theme() ;
$regions = system_region_list(variable_get('theme_default', 'garland'));
no patch, as I'm working on a very hacked branch of dynamicload.module
I feel this will interfere with other behaviour (switchtheme?)
The real fix is probably NOT to do this dynamicload_load() function as a side-effect of hook_menu. Is there a better (later) time to be doing this? Like just before render, not during initial URL/Menu-resolution.
Man that hurt!
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | dynamicload-regions_1.patch | 2.16 KB | nedjo |
Comments
Comment #1
nedjoNice sleuthing, and sorry to set you such a tough puzzle!
We can do most of what's needed in
hook_footer()(at least for PHPTemplate themes). But the 'left' and 'right' regions, if present, are populated beforetheme('closure')triggershook_footer(), so we need special handling for those two regions.I've applied the attached patch (to HEAD). As well as fixing the issue, this is an improvement from the previous implementation, as it loads regions of the initialized theme, not always the default one.
dman, can you test and, if this works for you, set to fixed? Thanks.
Comment #2
dman commentedI can confirm the patch supplied works, as in,
fixes the problem I saw and doesn't break..
But I'm unsure what the advantage was to preset the 'left' and 'right' ones at the early point it does.
Is it something to do with targeting regions?
Comment #3
nedjoHave a look at
phptemplate_page(). You'll see that calls to populate the left and right sidebars precede the rest of the variable generation--in particular, the calltheme('closure'), which is wherehook_footer()is triggered. Hence, we need to populate left and right regions beforetheme('page')is called.Comment #4
(not verified) commentedComment #5
csc4 commentedI'm confused - which version has this been fixed in as the dates don't seem to match the 5.x-1.x-dev versions? What should I download to get the fixed version for 5?