Hi,
The editablefields module uses ajax_load to deal with dynamic form injection to the DOM. It works well, however it doesn't seem to support Garland with custom colors. There's a support request in the editablefields issues queue that I believe is related to ajax_load: #359432: Editable fields change theme color on load with Views or on individual nodes
Looking at how Garland implements custom colors, it invokes a color.module function, _color_page_alter(), from its own phptemplate_preprocess_page() implementation to rebuild the CSS array of the page.
However, when modules such as editablefields send the response to ajax requests, theme('page') is not involved, so this particular processing made by Garland/color.module is not invoked, hence the custom colors od the site disappear when ajax_load processes the CSS array of the json response from the server.
Would it be possible to add something to ajax_load module to add support for this particular use of the Drupal CSS array?
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | ajax_load-361165-9.patch | 741 bytes | markus_petrux |
Comments
Comment #1
nedjoGood question. It looks complex to address. I'd welcome ideas.
Comment #2
markus_petrux commentedI haven't tested this, but I think it might be a start.
In ajax_load.module, function ajax_data_get_data():
Comment #3
Anonymous (not verified) commentedmarkus: Just tested your fix in Ajax Load 6.x-1.1. It worked for me, at least in the use cases I originally reported (#359432: Editable fields change theme color on load with Views or on individual nodes). Color shift no longer occurs at View or Node levels.
If you want to test other cases, let me know how I can help.
Thanks again--this makes two issues I've reported that you've solved!
Comment #4
ec commented+1
@Markus, thanks for your patch, I can too confirm that it works fine and as espected with editable field and views with Garland custom theme.
Comment #5
rokrI can confirm this patch works for theme 'Pixture Reloaded' as well. Thanks!
Comment #6
samhassell commentedpatch also works for me using pixture_reloaded.
Comment #7
markus_petrux commentedThanks for the feedback. I would say this is reviewed and tested.
@nedjo: please, let me know if you wish a formal patch or is it ok as in #2
Comment #8
nedjo@markus_petrux: Thanks! I've assigned you CVS access. Please go ahead and apply this patch to HEAD. (There is no other branch yet.)
Comment #9
markus_petrux commentedSweet! Thanks for the confidence, nedjo. :-D
I have committed the fix, with a little comment in reference to color.module and Garland theme. Attached.
Now, I guess this will available in the next automatic snapshot. Not sure because this is HEAD.
Comment #11
tm01xx commentedhi,
I'm using ajax_load module version 6.x-1.3 so it includes this patch already but my theme is still broken when using editablefield with views.
In my case, I'm using garland custom color theme as admin theme and another theme in front end. After the ajax_load, it changes the garland theme to another theme which causes break the admin page.
Please help.
Comment #12
tm01xx commentedFrom my understanding, seems it always loads the default theme which is front-end one?
Comment #13
tm01xx commentedAfter some tests I could confirm that ajax_load module is not working properly when you have 2 themes (one for admin and another for front end). The issue is that it replaces admin theme (css files) by the front end ones causing the site broken.
Steps to re-produce:
1. Having 2 themes, i'm using garland for admin, my custom theme for front end.
2. Using Views with editablefield in admin theme. You could set a test path like this: admin/test so that your page will use admin theme.
3. Run the path. The page is broken. Check the css files then you will see all are from the front end theme, not admin theme.
Comment #14
btopro commentedhaving a similar issue when using spaces / context since that will load in different CSS based on context. Why is it even loading CSS for the fields? Shouldn't it all be on the page anyway?
Similarly, i'm noticing an issue that seems related with page JS loading that I don't want to load or loading multiple times which sets events incorrectly in some instances.
Comment #15
mrjeeves commentedi have also had this issue with color related modules, the patch is stable.
Comment #16
markus_petrux commentedStill an issue with ajax_load 6.x-1.4?
Comment #17
markus_petrux commented@tm01xx: If your issue is with Admin Theme, the solution could come from reviewing the paths where the Admin Theme should be enabled to include the paths used by Views Ajax.
@btopro: Probably the same problem. You may need to review the rules that define the contexts.
In short, the problem may come from something external to Ajax Load.
If suggestions don't help. Then I think it would be better to open a separate issues. This one has a patch that was included in Ajax Load 6.x-1.2. Thanks for your collaboration.
PS: Restoring original issue status, back to "closed (fixed)".
Comment #18
lort commentedI had the same issue that came up when I installed editablefields and ajax_load.
ajax_load version used: 6.x-1.4
3 themes installed and enabled, and using 'sections' module to change theme based on path.
when I ajax_load is used by editablefields in a sections enabled theme, the default theme's css are loaded.
so I went through ajax_load.module and after commenting out this line of code, $data->css = $extra['css']; in ajax_load_ajax_data_alter(), everything came back to normal, without noticing anything going wrong in theme or functionality.
I did not investigate any further, as in how or why etc, cause i'm on a tight schedule.
Hope this helps.
Comment #19
vishun commentedNotice: Undefined index: logo in _color_page_alter() (line 114 of /var/www/modules/color/color.module).
There appears to still be an issue with 6.x-1.4 when the color module is in use with Garland (and probably other themes that use the color module) that causes a spammie watchdog notice. The _color_page_alter(&$vars) function normally receives a lot more $vars than ajax_load is providing. In particular it is missing the 'logo' index key which causes a notice on every (admin?) page load.
This can be easily fixed by defining something, anything, for the logo key. This may not be the exact proper fix but it does resolve the undefined index notice. For example, add $return['logo'] = null; to function ajax_data_get_data();