Problem/Motivation
In the Ajax API documentation, the example references the contrib module config_translation, which last had a commit in 2013 and is marked as obsolete.
As a result:
* The example form API array won't work on a newly installed Drupal core.
* It doesn't follow usual module folder structure (lib/ rather than src/?)
* DateFormat::ajaxSample still treats $form_state as an array, not a FormStateInterface object.
* More generally, the example won't be receiving any updates in the future.
See e.g. http://cgit.drupalcode.org/config_translation/tree/lib/Drupal/config_tra...
Proposed resolution
Add an example of a callback in the relevant .api.php file in core, and reference this instead. Probably even rearrange the documentation, so the callback is first: that way the #ajax Form API example will work "straight away".
This means the docs can still link out to other examples, but they're not dependent on them being kept up to date.
Remaining tasks
1. Add example to documentation.
2. Review and approve patch.
User interface changes
None.
API changes
None.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #20 | reroll_diff_19-20.txt | 743 bytes | shubham chandra |
| #20 | 2798595-20.patch | 5.27 KB | shubham chandra |
| #19 | reroll_diff_3-19.txt | 2.35 KB | shubham chandra |
| #19 | 2798595-19.patch | 5.29 KB | shubham chandra |
| #18 | ajax_api_has_incomplete-2798595-18.patch | 5.3 KB | Ankit.Gupta |
Comments
Comment #2
jp.stacey commentedComment #3
jp.stacey commentedPatch attached for review.
Comment #4
jp.stacey commentedComment #6
christianadamski commentedStrongly agreeing!
Comment #17
amber himes matzThis looks like an excellent contribution that has been languishing here. Let's get it re-rolled so that we can test out the example module in the patch and give it a proper review.
Comment #18
Ankit.Gupta commentedReroll the patch #3 with Drupal 9.5.x
Comment #19
shubham chandra commentedReroll the patch #3 with Drupal 9.5.x and Fixed custom commands.
Comment #20
shubham chandra commentedReroll the patch #19 with Drupal 9.5.x and Fixed custom commands.
Comment #22
smustgrave commentedNot entirely sure this is correct
I can't find any reference of respondToAjax in the repo so not sure this is the correct example