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.
At present the DialogController only supports routes with _content.
We need it to support _form and _entity_form but also anything else contrib adds.
Related Issues
#1879120: Use Drupal-specific image and link plugins — use core dialogs rather than CKEditor dialogs, containing alterable Drupal forms
#1842036: [META] Convert all confirm forms to use modal dialog
Remaining tasks
Write tests
Comment | File | Size | Author |
---|---|---|---|
#32 | interdiff.txt | 805 bytes | jibran |
#30 | dialog-form-1998698.30.interdiff.txt | 3.77 KB | larowlan |
#30 | dialog-form-1998698.30.patch | 15.73 KB | larowlan |
#27 | dialog_routes-1998698-27.patch | 12.96 KB | jibran |
#27 | interdiff.txt | 1.14 KB | jibran |
Comments
Comment #1
larowlanNeeds tests still but this works for _form
Comment #2
andypostdebug?
Comment #4
jibranForm #1842036-66: [META] Convert all confirm forms to use modal dialog while working on the issue I think we should improve DX experience for simple links and buttons. @quicksketch has added some improvements in #1879120-57: Use Drupal-specific image and link plugins — use core dialogs rather than CKEditor dialogs, containing alterable Drupal forms related to ckeditor.
Comment #5
dawehnerCan't we avoid to duplicate the functionality of both ControllerResolver and Httpkernel here? Why not just use HttpKernel->forward and change the request headers first?
Comment #6
larowlanFirst patch includes #1983164: Entity Forms in ajax requests don't find the route
Please review the -do-not-test.patch one.
Comment #8
larowlandamn last patch is wrong, origin out of date
Please review the do-not-test file
Comment #10
larowlan#8: dialog-form-1998698.6.includes-1983164.patch queued for re-testing.
Comment #11
quicksketchHm, is testbot stuck on this patch? Seems like it's been testing for the past day with no result.
Even though this is A) a test that few will ever see and B) a reference to a Bob Dylan song, I think it'd be safer of us to avoid any controversy by replacing this with a more generic message (bunnies and unicorns apparently widely accepted).
Comment #13
larowlanwaiting for #1983164: Entity Forms in ajax requests don't find the route
Comment #14
jibranWait is over :).
Comment #15
larowlanRe-rolled now that #1983164: Entity Forms in ajax requests don't find the route is in.
Passes dialog tests locally.
Comment #16
jibranUploading #8 do not test patch with suggestion in #11.
All above fails passes locally.
Comment #18
jibranThis passes locally.
Comment #19
quicksketchThis is because the test assumes too much. It shouldn't assume either clean URLs or being installed at the root level of the host domain. Since testbot's root directory is /checkout/, not /, the test doesn't pass with
action="/ajax-test/dialog"
being hard-coded.Comment #20
quicksketchSame patch, but uses xpath instead of assertRaw against the HTML strings. This approach should make the tests less sensitive to breakage in the future, since they only check for a form with a certain ID being present, rather than exact HTML strings.
Comment #21
larowlanThanks @quicksketch, perhaps we can ping Wim for a review
Comment #23
quicksketch#20: dialog_routes-1998698-20.patch queued for re-testing.
Comment #24
larowlanthis is +1 RTBC from me, but I'm too invested to mark it myself.
Comment #25
quicksketchThanks @larowlan. I think I'm probably qualified to mark RTBC, having only fixed tests.
Comment #26
alexpottDialogController::dialog() is still using the $_content variable which now does not exist...
Unnecessary change
Comment #27
jibranI don't know how to replace
.
I hope interdiff is fine.
Comment #29
jibran#27: dialog_routes-1998698-27.patch queued for re-testing.
Comment #30
larowlanThis
a) Uses the route name to derive a dialog target for a non-modal when none is given.
b) Adds tests for said change (which would have found the regression identified at #26 if we'd had them)
Comment #31
quicksketchThanks @larowlan I tried rerolling this today but couldn't figure out for the life of me how to acquire the right variable there.
One minor nitpick is we're not using drupal_html_id() properly here:
drupal_html_id() should be around the whole ID:
Otherwise you may end up with $route_name matching some other ID already on the page just by mere coincidence, which results in "--2" being appended to the ID.
Comment #32
jibranLet's do this instead
$target = '#' . drupal_html_id("drupal-dialog-$route_name");
So I was not alone :D
Comment #33
dawehnerThe feedback from alex got adressed so back to RTBC.
Comment #34
alexpottCommitted f7f7f37 and pushed to 8.x. Thanks!