Hello folks,
I have an issue I cannot figure out: I have multiple widgets on the same node add page (that use the admin theme).
On my dev. environment, it works like a charm.
But since I commit to another server, I just can't do anything that implies Ajax. After a long while (at least 7-8 seconds), all views on the page are reloaded with the front theme (not the admin one) and I just can't do anything beyond this point.
After digging a little further, I realized that the theme callback (ajax_base_page_theme) does not receive $_POST['ajax_page_state']['theme'], even though it was actually sent by Ajax.
Forcing the theme callback to return my admin theme is also a problem: useless JS files that should not be loaded actually load and break the widget. Therefore, after adding 2 elements to the list, adding a third one provokes a JS error (Uncaught TypeError: Object [object Object] has no method 'once' in Drupal.behaviors.contextualLinks.attach)
I applied the patch in https://drupal.org/node/1309632 to have checkboxes, just it case it has something to see.
At this point, I don't really know what to do. Any idea is welcome !
Thank you very much !
Comment | File | Size | Author |
---|---|---|---|
#17 | #1-ervw-ajax-on-admin-theme-2137237.gif | 252.83 KB | nithinkolekar |
#4 | entityreference_view_widget-use-admin-paths-for-ajax-menu-callbacks-2137237-4.patch | 527 bytes | jsacksick |
#2 | 0001-patched-entityreference-theme.patch | 1.17 KB | lavoiesl |
Comments
Comment #1
lavoiesl CreditAttribution: lavoiesl commentedYes, I am having the same issue. The View seems to not know it is in admin.
Comment #2
lavoiesl CreditAttribution: lavoiesl commentedHere is a quick patch to use the admin_theme for ajax views.
Comment #3
jonastg CreditAttribution: jonastg commentedI'm working in a site with admin & front themes. When the widget loaded the view, the layout is broken because the ajax request loaded js/css from the front theme. Surfing the web I found this post http://www.duckzland.com/content/drupal-7-force-ajax-use-admin-theme and the first option works for me.
I added this chunk of code in .module file:
Comment #4
jsacksick CreditAttribution: jsacksick commentedThanks for spotting this, I committed the approach suggested by jonastg.
Comment #6
danreb CreditAttribution: danreb commentedI know this has been closed with the committed patches but now I am having problem using entity reference view widget in an entityform because it is now returning the response with js and css of the admin theme (seven in my case) and it's breaks the front end theme because entityform was not using admin path and the entity view reference widget now thinks that it always invoked inside an admin path.
Looking and reading in the link provided in #3 it seem's that solution 2 is the more correct way for this problem and it is also the suggestion here -> https://api.drupal.org/api/drupal/includes!ajax.inc/function/ajax_base_p...
anyone having same issue with me now?
Comment #7
SantVim CreditAttribution: SantVim commentedSame happens to me. I use adaptive theme for front, the widget only loads the admin theme.In my case the view is for authenticated users to select the nodes not just the admins, so its kind of important to sustain the front end look. Great module btw, totally loving it :)
Comment #8
jsacksick CreditAttribution: jsacksick commentedSo mark this as needs work, feel free to post a patch, in the meantime you could still use the
hook_admin_paths_alter()
, See https://api.drupal.org/api/drupal/modules%21system%21system.api.php/func...Comment #9
jsacksick CreditAttribution: jsacksick commentedYou should checkout the latest dev version, it should be fixed (the 2.x branch).
Comment #10
SantVim CreditAttribution: SantVim commentedHey been testing the latest dev, works fine with the front end theme .... but the exposed filters in the view are not working...throws an AJAX HTTP error occurred (they were working good before in alpha3).... Should i open a new issue???
EDIT: If there is one exposed filter the ajax error occurs once and after dismissing it the ajax works. If there are multiple exposed filters the error persists and exposed filter vakues are not submitted.
Comment #11
jsacksick CreditAttribution: jsacksick commentedI'm using the beta1 on two different sites and the exposed filters are working.
Comment #12
SantVim CreditAttribution: SantVim commentedYeah...seems the issue was not due to exposed filters but because of exposed form autosubmit.
Unchecked the autosubmit now it works great.
Am using a user view with the state and city exposed.
I've selected a few users in the modal and closed it. Now, without saving the node form if i open the modal again the exposed filters stop working.
Comment #13
jsacksick CreditAttribution: jsacksick commented@Dhamub you're right, it wasn't working anymore, apparently because the js workaround we have wasn't triggered anymore on click because of the ajax behavior added to the add more button, this workaround is here due IMO to a views bug, See #1809958: Views with exposed filter (ajax enabled) inside modal window (ctools), in the meantime I updated our js workaround to react on "mousedown" instead of "click", See f92ba1e
Comment #15
Yuri CreditAttribution: Yuri commentedInstalled the latest dev..and still the Ajax error 200 appears when using an exposed filter.
I'm using the Omega 3.1 theme, and it seems it can't find the responsive style sheet of the theme.
Comment #16
jsacksick CreditAttribution: jsacksick commentedHi, I just tested the latest 2.x dev version with omega 3.1 and omega 4.2 with the node_admin_theme variable set to 0 (Meaning node add form on front). and everything worked as expected.
Comment #17
nithinkolekar CreditAttribution: nithinkolekar commentedThis problem is still exist.
Tested with bootstrap subtheme as main theme and seven as admin theme where admin theme is set for creating and editing node pages.
Comment #18
NIKS_Artreaktor CreditAttribution: NIKS_Artreaktor commented@nithinkolekar
Try increase max_input_vars = 2000 (by default 1000)
It helped me with on admin theme Seven (non bootstrap theme) and Bootstrap -as base theme.
(https://www.drupal.org/node/2156371#comment-10634956)
OR
Try module
https://www.drupal.org/project/themekey
Added rule
If drupal:path = system/ajax (for example)
to use Admin theme.
I could help.
Comment #19
rooby CreditAttribution: rooby commentedThere still seems to be something up with this.
I have a template preprocess function in my default theme (the theme used for the node field in question) after adding values to my entity reference field it doesn't run the code, however when you next load the form it does.
Comment #20
rooby CreditAttribution: rooby commentedI think this is related: #2534874: Does not update the $form_state variable when a selection is made.
When you click the add another button it does some ajax and loads the view modal, which is potentially in a different theme. Then when you submit the modal, ajax replaces elements in the original form (which again, may not be in the same theme).
The problem seems to lie in having the ajax submission of the views form replacing elements in a different form.