feat: #3547306 Add interactive refinement capability to Field Widget Actions

Adds opt-in interactive refinement to Field Widget Actions, allowing users to iteratively improve AI-generated content before accepting it into a field.

Changes

  • FieldWidgetActionBase: adds enable_refinement and refinement_modal_title config options; extends returnSuggestions() with an $options array supporting refinable mode
  • Hook/FieldWidgetAction: registers field_widget_actions_refinable_suggestions theme hook
  • New RefinementAwareInterface: contract for plugins that support refinement (extracts content from field items, checks if refinement is enabled)
  • New CSS/JS/Twig: refinable suggestions modal with Accept, Refine, and Cancel controls; iterative refinement via AJAX

How to test

  1. Enable a field widget action on a text field
  2. In the action config, check "Enable interactive refinement"
  3. On a content edit form, click the action button
  4. Verify the modal shows Accept/Refine/Cancel instead of the standard suggestions list
  5. Enter a refinement prompt and click Refine — modal should update with new content
  6. Click Accept — content should populate the field

Notes

Plugin implementations (wiring up specific automators to RefinementAwareInterface) are handled in a companion MR against the AI module.

Closes #3547306

Merge request reports

Loading