Problem/Motivation
The current implementation in RenderElement::preRenderAjaxForm() destroys any url options when a Url object is passed for form ajax. This was the root cause of probably 40+ hours of ctools debugging and a huge thanks to dawehner for ultimately sorting it. If a Url object is generated with options in place, we should respect that and not require they be restated in ['#ajax']['options'] manually.
Proposed resolution
Instead of overwriting the Url objects options so whatever is set in ['#ajax']['options'] (which could be empty) simply iterate over the options array and set individual options which will preserve options passed with the Url object.
Remaining tasks
Provide patch
Write tests
Get it done
User interface changes
None
API changes
Should not affect existing core implementations, and might smooth the way for some contrib modules as they begin implementing work here.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 2547705-ajax_url_options-4.patch | 1.04 KB | tim.plunkett |
| #2 | 2547705-1.patch | 880 bytes | eclipsegc |
Comments
Comment #2
eclipsegc commentedA simple patch to demonstrate the idea.
Eclipse
Comment #3
eclipsegc commentedWhat I tried to do:
What I have to ACTUALLY do to get it to work:
Note: Don't even try passing a string to the 'url' key... that will definitely not work out for you. (also seems like a problem, since you HAVE to pass a Url object for this magical incantation to work)
Eclipse
Comment #4
tim.plunkettI think this should be safer.
Comment #13
larowlanClosed #2681721: ajax_form query argument is not added when specifying a custom ajax URL as a duplicate
Comment #14
jibranI'm not sure how to write a test for this. Can we have steps to reproduce here? Maybe those will help to write a test.
Comment #19
smustgrave commentedThis issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request as a guide.
The tests in #4 and steps to reproduce in #14