Afform - allow ids to be passed directly into the directive #23656
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This gives Submit Forms the same feature as Search Forms, entity ids can be passed directly into the directive as 'options', allowing ids to be passed around internally.
Before
With an Afform named MyForm and an entity named Contact 1, you could enable url-autofill for that entity and append
#/?Contact1=123
to the url to supply an existing contact id.After
The above still works, but to facilitate embedding an afform into other places e.g. a block or a contact summary tab, you can pass the id directly into the directive e.g.:
<my-form options="{Contact1: 123}"></my-form>
Comments
Note that this same technique already works with Afforms of type "Search" so this just extends the functionality to work with submission forms as well.
Technical Details
See discussion at systopia/de.systopia.eck#48 (comment)