- Issue created by @maursilveira
- Merge request !20Issue 3451146: Use replaceWith instead of replace in #ajax form settings β (Open) created by maursilveira
- last update
26 days ago 9 pass - Status changed to Needs review
26 days ago 4:05pm 30 May 2024 - π¨π¦Canada maursilveira Windsor, ON
I've created a merge request with the adjustment.
- Status changed to RTBC
26 days ago 2:55am 31 May 2024 - πΊπΈUnited States benjifisher Boston area
I reviewed the MR, and it does just what the change record says. (Thanks for adding a link to the change record in the issue summary.) I also searched for other uses of
'method' => 'replace',
, and I did not find any.The hard part is testing. From the issue description:
Both methods work identically before Drupal 10.3.0, but starting in this version, only
replaceWith
is supported.Not quite. Starting with Drupal 10.3.0,
replace
generates a deprecation notice, which is not easy to test. I did it by hacking the line@trigger_error('Using "replace" as the method in #ajax property is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. Use "replaceWith" instead. See https://www.drupal.org/project/drupal/issues/3303557', E_USER_DEPRECATED);
in
Drupal\Core\Render\Element\RenderElementBase::preRenderAjaxForm()
, removing the@
so that the error is not suppressed. After that change, I see a deprecation notice (debug level) in the logs each time I load the page at/admin/config/system/shield
.When I make the change in the MR, I do not see any log messages when loading that page.