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
- Review
- Write update hook
- 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.