Add a common method for suggestions in Field Widget Actions

Created on 8 July 2025, 6 days ago

Problem/Motivation

Currently there is the possibility to either process and fill out a field automatically, but also process and give multiple suggestions back and pick from them.

The later can be viewed in the AI Content Suggestions module where it returns a suggestion pick.

This will probably be a common pattern for processors to want to implement, and instead of every plugin implementing this by copy and pasting code, we should have a common method for it, that implements the JS libraries needed and returns an AjaxResponse that can be used as the response of the form.

Proposed resolution

  • Discuss if the following is the correct solution.
  • Create a method on the base class FieldWidgetActionBase that is called returnSuggestions.
  • It should return an AjaxResponse, that the processor can return.
  • It should take an associative array of suggested values, where the key is the value and the value is a human readable suggestions, that can take HTML in the case of images, audio or other multimodalities.
  • It should take the field name.
  • It should take the delta, if its a multivalue field.

Remaining tasks

  • Discuss if it should recognize patterns instead of give it HTML - image file becomes an tag etc.
Feature request
Status

Active

Version

1.2

Component

Field Widget Actions

Created by

🇩🇪Germany marcus_johansson

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @marcus_johansson
  • 🇩🇪Germany jurgenhaas Gottmadingen

    This is great. I wonder if it could even be more optimized such that the returnSuggestions method only returns a key/value array and the whole ajax implementation is done by the base class. That way, the implementing developers have even less work to do, and we only maintain the ajax part once.

Production build 0.71.5 2024