Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
The documentation for the render array example in AJAX Example is incorrect. It says that there's a nojs path on the callback, but Drupal doesn't actually magically change the path variable for us.
Proposed resolution
This example really doesn't have a non-JS fallback, since it uses AJAX commands.
Change the documentation to explain what actually happens.
Remove {nojs} from the callback path.
Amend whatever code deals with nojs.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#6 | interdiff.txt | 745 bytes | jlbellido |
#6 | 0006-Issue-2933639-Make-ajax_example.library-depend-on-dr.patch | 2.69 KB | jlbellido |
| |||
#2 | 0001-Issue-2933639-Make-ajax_example.library-depend-on-dr.patch | 2.43 KB | marvil07 |
Comments
Comment #2
marvil07 CreditAttribution: marvil07 at Isovera for Pegasystems commentedWith this patch, nojs fallback is working for me.
It may be related with the route default, not entirely sure, but the change points to it.
Comment #4
jlbellidoThe last patch doesn't apply anymore
Comment #5
jlbellidoComment #6
jlbellidoRerolled the attached patch and fix the errors in the tests.
Comment #7
earthday47I agree.
I think also in the 8.7.x world, the form handler/controller method wouldn't even use the "$nojs" parameter and instead detect the wrapper from the request, something like this. I took this from search_api module
Comment #9
marvil07 CreditAttribution: marvil07 as a volunteer commented@jlbellido, thanks for the new patch and fix.
@earthday47, that sounds interesting, I investigated a bit, and added a new issue with a lot more details, see #3046262: Consider ajax detection approach.
I have added the latest patch to 8.x-1.x.
Comment #10
rpayanm