Problem/Motivation

Part 9 of splitting #3595219: 3.0 Exploration. This issue adds the two autocomplete element types:

  • webform_autocomplete — a text field with a configured list of autocomplete suggestions.
  • entity_autocomplete — a reference field that autocompletes against entities, including its default referenced entities.

Neither is exposed in 3.x today.

Proposed resolution

  • webform_autocomplete: expose its fields and resolve autocompleteItems as a plain array of strings, backed by a WebformAutocompleteMatchOperator enum.
  • entity_autocomplete: add a webform_entity_autocomplete producer exposing the element's configuration, and a webform_element_entity_autocomplete_default_entities producer that resolves the default referenced entities (with their cacheability — building on the default-value/cacheability foundation in #3598935: Improve cacheability and rendering).

Remaining tasks

  • Add src/Enum/WebformAutocompleteMatchOperator.php; wire into WebformSchemaBuilder.php.
  • Add producers WebformEntityAutocomplete.php and WebformElementEntityAutocompleteDefaultEntities.php; resolve autocompleteItems as [String].
  • Register both element types in WebformExtension.php.
  • Tests: AutocompleteTest, EntityAutocompleteDefaultEntitiesTest, WebformEntityAutocompleteTest, plus the autocomplete.gql / webform_entity_autocomplete.gql fixtures and shared test-form additions.

API changes

Additive: new webform_autocomplete and entity_autocomplete element types, the WebformAutocompleteMatchOperator enum, and default-entity resolution for entity autocomplete. No fields removed.

Release notes snippet

The webform-autocomplete and entity-autocomplete element types are now supported, including autocomplete suggestion lists and default referenced entities.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

pfrenssen created an issue. See original summary.

  • pfrenssen committed b282a323 on 3.x
    feat: #3599016 Autocomplete elements
    
    By: dulnan
    By: pfrenssen
    
pfrenssen’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.