Active
Project:
Fences - Semantic field markup and classes
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
5 Aug 2014 at 16:54 UTC
Updated:
8 Aug 2014 at 20:52 UTC
Jump to comment: Most recent
Comments
Comment #1
heddnHere's the offending code in fences.module. The include_once registers the default theme template.php for the first page view. For me on cache flush this is usually an admin page. The bug can be be avoided if the first page view is not an admin page.
Comment #2
heddnIn _fences_theme_registry_alter() I tried removing any preprocess or process functions for the admin theme, but that didn't help. In the problem at hand, the include_once makes all the code of template.php available on first page view. Not sure how to make the code not available on first page view.
Comment #3
heddnComment #4
azinck commentedI don't think there's a good way to accomplish what the module is attempting to do here. It's attempting to fire hooks in the default theme even if it's not the current theme. I assume this is in order to load all of the Fences suggestions provided by the default theme so that they can be selected through the admin interface. Unfortunately, this has the side-effect of loading the default theme's template.php and running any code in there.
I should note: I'm working with heddn. The specific issue he mentioned of the hook_css_alter() being fired on the default theme was a bit of a red herring (and an error on our part). That was occurring because of a naming collision between our default theme and our install profile. So, to be clear, the problem with including the template.php of the default theme is *not* that it will lead to firing hooks that shouldn't get fired in the default theme, but only that any "naked" php in the default theme's template.php will get run, thus possibly impacting the current theme.
I'll confess that I'm not totally sure that putting "naked" php (code not in a class or function) in template.php is considered a good practice. Is there documentation about that anywhere?