Autofill: add support for current/any source entity

Created on 26 September 2021, about 3 years ago
Updated 16 November 2023, about 1 year ago

Problem/Motivation

The current autofill functionality only allows to find the last submission under the same source entity. Adding support for configurable source entity selection (current, any) would make this feature even more useful.

A usage scenario:
- An "event registration" webform.
- An "event" content type, with two nodes, "Event A" and "Event B". Both nodes referencing the "event registration" webform.
- Registering for "Event A" should then allow a much quicker registration for "Event B", by configuring the webform to autofill from 'any' source entity.

Steps to reproduce

N/A

Proposed resolution

- Implement "autofill_source" setting for webforms. Support only 'current' and 'any', for now.
- Expose configuration in Settings -> Submission
- Update WebformSubmissionForm so 'autofill' uses autofill_source when trying to look up the latest submission.

Remaining tasks

  1. Review
  2. Write update hook
  3. Add tests

User interface changes

- A new select added under Settings -> Submission -> Submission Autofill Settings

API changes

- None, fully achievable using the existing querying mechanism.

Data model changes

- Webform entity:
-- Add 'autofill_source' setting
-- Allow only 'current', 'any'. Define possible values as constants in WebformSubmissionStorageInterface.

Feature request
Status

Fixed

Version

6.0

Component

Code

Created by

🇨🇴Colombia jedihe

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024