$_advagg['ctools_patched'] only set when ctools/includes/ajax.inc is loaded, not on every page. advagg_theme_registry_alter() is run only once, then the theme registry is cached. It happens that when advagg_theme_registry_alter() runs, ajax.inc is not loaded, thus ctools_ajax_page_preprocess is not removed from the theme registry. That causes duplicate content in the closure.
Also sometimes the 'css' array is lost. I'm debugging, but haven't got there yet. I have ctools patched. Screenshot attached. 'css' is present only after cache is clear, and disappears after that.
http://dev.jcisio.com/snap/20120723233952.png
http://dev.jcisio.com/snap/20120723234119.png
Comment | File | Size | Author |
---|---|---|---|
#5 | advagg-1698210-4-fix-ctools.patch | 535 bytes | mikeytown2 |
Comments
Comment #1
jcisio CreditAttribution: jcisio commentedIn fact, ctools_ajax_page_preprocess is not a hook implementation and is never in the 'preprocess functions' array. It is called indirectly in ctools_preprocess_page(). The problem comes from elsewhere.
Comment #2
jcisio CreditAttribution: jcisio commentedI continue the debugging: the array of loaded CSS is added using advagg_advagg_css_pre_alter (hook implementation). This hook is called only in advagg_process_css(). This function is called in:
- advagg_get_js_css_get_array(): this is a helper function, is not directly used in AdvAgg but helps other modules like QuickTabs.
- advagg_processor(): a page preprocess function. However at this level, if the full cache is enabled (it is by default), there is a big chance that the advagg_process_css() is not called.
So, a workaround is to disable the advagg full cache setting. The fix would be to save also the $css_files array in cache.
I didn't dig further to see why there is no similar problem with the JS.
Comment #3
rjbrown99 CreditAttribution: rjbrown99 commented+1, this is a problem.
Easy fix as long as you don't mind including ctools ajax in hook_init, just add this above that stanza:
... where the final looks like so:
Comment #5
mikeytown2 CreditAttribution: mikeytown2 commentedctools_include('ajax'); has been added to advagg_init.