A few things..
Firstly, creating a new theme specific variables function doesn't get picked up. I tried with "garland_preprocess_page()". Cleared registry and it still won't see it.
Preprocess functions for the 'node' hook have two entries for "template_preprocess_node". I'd guess that it's running twice for each node.
Adding a variables function i.e. "phptemplate_preprocess_HOOK()" *without* a .tpl.php file in the themes directory is ignored. Maybe not a big deal but I think this would cause less confusion. Let themers keep a .tpl file inside the module folders if they wish but still have the ability to alter $variables.
Lastly, there should be a clear and easy way to keep the registry un-cached for theme dev. What would be the best way to do this. Documenting "drupal_rebuild_theme_registry()" to be placed inside the theme or should there be a checkbox in the performance section? --either way, I'm sure people will get a bit confused about this.
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | engine_theme_register_whoops.patch | 607 bytes | dvessel |
| #14 | engine_theme_register_2.patch | 1.36 KB | dvessel |
| #9 | engine_theme_register_1.patch | 1.73 KB | dvessel |
Comments
Comment #1
merlinofchaos commentedI'll look more into registering preprocess functions even without a template, but it looks like it might be a little bit difficult, due to when discovery of that is actually made.
I think the general consensus is that devel.module could very easily have a setting to clear the cache or certain caches during hook_boot or whatnot, and that's definitely where such a setting should go.
Comment #2
dvessel commentedThe issue with "template_preprocess_node" being registered twice was fixed with this patch for cleaning the default page.tpl.php. An unlikely place. http://drupal.org/node/163723
Theme specific preprocess variable functions still don't work. Tried with Garland.. page, node, profile_block..
If it ends up being too troublesome, maybe try for D7? It's not critical or anything. I think in most cases, editing variables would lead to altering the template itself.
Another issue I found with trying to convert search.module to templates is that theming forms is completely broke or I missed something completely. The existing theme functions for forms aren't even being used so I'm stuck with that. The issue is waiting here: http://drupal.org/node/164032
Comment #3
merlinofchaos commentedTheming forms works fine, but they still have to be registered. Which is a little frustrating, since you can't just create a theme_blahblahblahform, you have to register it and clear the cache.
I haven't figured out a decent solution for that. You can still override them, but that'll mean implementing hook_theme() in your theme and creating an override. That's something we'll need to document. "Overriding unregistered theme functions".
Comment #4
dvessel commentedIt looks like there's another problem with that. Setting up a default "template_preprocess_search_theme_form" function and registering it still prevents it from being called.
I checked the registry and it's present but wherever it's being calling has to change too.
On top of that, forms use drupal_render(). Multiple preprocess functions don't seem to fit well with it. Which one does the rendering? template_preprocess or the theme trying to override it.?
Comment #5
dvessel commentedbah, never mind about how it's called. There's a bug:
callback arguments don't match.
Sorry to bring this up so late, I'm just realizing this now after working wit hit.
Comment #6
dvessel commentedMarking as critical due to this issue:
Also placed a separate issue for the search form. http://drupal.org/node/164351
Comment #7
dvessel commentedHere's another one.
Inside drupal_discover_template(), path_to_theme() points into the modules folder if the variable function that suggests the template is inside the module folder.
This doesn't happen with suggestions from 'page' or 'node'. Only difference being that they are inside includes/theme.inc.
Comment #8
dvessel commentedThat had nothing to do with the registry. Made a separate issue here. http://drupal.org/node/165343
Comment #9
dvessel commentedThis is for the issue I mentioned in #6.
_theme_process_registry creates both engine and *theme* specific variable functions.
Comment #10
dvessel commentedComment #11
dvessel commentedMore appropriate title.
This only works when a template file exists inside the folder. Merlinofchaos informed me that without the template in the themes folder, it makes it difficult to discover but that's not critical.
Comment #12
merlinofchaos commentedOk. This is important, and this works.
Comment #13
gábor hojtsyWe have done quite some modification around this part of the code in the last days AFAIR. This looks like it needs a rethink/reroll/reposition.
Comment #14
dvessel commentedHere it is..
Comment #15
dvessel commentedThis really needs to be reviewed. Without it, themers will have to do more work to register these manually.
Comment #16
dvessel commentedUh, I mean commited. :)
Comment #17
dries commentedYep, this is truly important to get right. Committed it to CVS HEAD. Thanks for the hard work.
Comment #18
dvessel commentedNot sure how I didn't catch this. It was working fine before but with all the changes in HEAD, it's causing a bunch of duplicate preprocess functions causing doubles of each region.
The way the array was setup just kept building up duplicates. Sorry bout that.
Comment #19
gábor hojtsyThanks, committed.
Comment #20
(not verified) commented