Improve Field Widget Actions architecture with Form API in dialog
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3560562. --> Reported by: [scott_euser](https://www.drupal.org/user/3267594) Related to !1 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>The unordered list of buttons in the modal is very limiting in terms of providing options and getting user decisions. The suggestions js is also very limiting in terms of then mapping what gets submitted to update the parent e.g. node edit screen.</p> <h4 id="summary-steps-reproduce">Steps to reproduce</h4> <p>Attempt to do anything other than a list of buttons in a field widget action plugin: not possible.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <ol> <li>Create a new separate base class like FieldWidgetFormActionBase (to avoid BC to existing plugins) that instead of an array of text suggestions is: <ol> <li>build form</li> <li>validate form</li> <li>submit form</li> </ol> </li> <li>Create Ajax Commands that fill the fields, e.g. fill ckeditor, fill text, fill entity reference tags, etc (until we have handled most common target inputs) <ol> <li>Refactor the existing FieldWidgetActionBase/suggestions.js to use these more granular ajax commands instead</li> <li>Have the submit form from 1c essentially run Ajax Commands: fill field, close modal</li> </ol> </li> </ol> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <ul> <li>&#9745; Create merge request</li> <li>&#10710; Wait for merge of <span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/field_widget_actions/-/work_items/3563495" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/field_widget_actions/-/work_items/3563495</a></span></li> <li>&#10710; Wait for merge of <span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/field_widget_actions/-/work_items/3563524" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/field_widget_actions/-/work_items/3563524</a></span></li> <li>&#9744; Feedback/address feedback</li> <li>&#9744; Merge this</li> <li>&#9744; (Optional) Create follow-ups for refactoring suggestions base to leverage Drupal Ajax</li> </ul> <h3 id="summary-ui-changes">User interface changes</h3> <p>Status quo for existing FWAs BUT new FWAs could be created that are forms in the modal.<br> Example:</p> <p><img src="https://www.drupal.org/files/issues/2025-12-16/example-modal-form.png" alt="Example modal form"></p> <h3 id="summary-api-changes">API changes</h3> <p>New FieldWidgetFormActionBase available optionally for use.</p> <h3 id="summary-data-model-changes">Data model changes</h3> <p>N/A</p>
issue