Move handling of selection settings and route to a #process callback of the form element

Created on 27 June 2025, about 1 month ago

Problem/Motivation

Currently, the field widget implementation (Drupal\autocomplete_deluxe\Plugin\Field\FieldWidget\AutocompleteDeluxeWidget) contains code to handle the selection settings (store them in key value store) and add the route with its parameters on the element.

By doing so:

  • it's difficult to override certain selection settings from custom code - e.g. in a hook_field_widget_single_element_form_alter() implementation - without having to duplicate a lot of code (store new selection settings in the key value store, set the route again with the right parameters)
  • it requires duplicating the same code when trying to use the autocomplete_deluxe form element as a standalone element in a form, outside of any entity fields

Proposed resolution

Move parts of the code related to selection settings & route with its parameters from the widget implementation to the form element implementation, similar to how it is done in Drupal core's entity autocomplete form element. See Drupal\Core\Entity\Element\EntityAutocomplete::processEntityAutocomplete().

Remaining tasks

  • ✅ File an issue
  • ➖ Addition/Change/Update/Fix
  • ➖ Testing to ensure no regression
  • ➖ Automated unit testing coverage
  • ➖ Automated functional testing coverage
  • ➖ UX/UI designer responsibilities
  • ➖ Readability
  • ➖ Accessibility
  • ➖ Performance
  • ➖ Security
  • ➖ Documentation
  • ➖ Code review by maintainers
  • ➖ Full testing and approval
  • ➖ Credit contributors
  • ➖ Review with the product owner
  • ➖ Release notes snippet
  • ❌ Release

API changes

  • N/A

Data model changes

  • N/A

Release notes snippet

  • N/A
Feature request
Status

Active

Version

2.1

Component

Miscellaneous

Created by

🇧🇪Belgium Cyberwolf

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

Comments & Activities

Production build 0.71.5 2024