Repository navigation
[6.x] Add multiple option to form Dictionary fieldtype - #16132
Merged
Merged
Conversation
Amp-Thread-ID: https://ampcode.com/threads/T-f788b47a-e412-43ac-9a7a-988c14971d30 Co-authored-by: Duncan McClean <duncan@duncanmcclean.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull request adds a "Multiple" toggle to the Dictionary form fieldtype, like the one on the Dropdown fieldtype.
Previously, the Dictionary field only had a "Max Selections" setting. The underlying
dictionaryfieldtype treats anything other thanmax_items: 1as a multi-select, so the only way to get a single select was to set Max Selections to 1.When Multiple is off, this PR passes
max_items: 1to the underlying fieldtype, which makes the builder preview, the Antlers/Blade views, emails and charts treat the field as a single choice. Max Selections now only shows when Multiple is on.Multiple defaults to
true(unlike the Dropdown) so existing Dictionary fields keep behaving the same. Fields saved withmax_items: 1stay single.Amp thread: https://ampcode.com/threads/T-f788b47a-e412-43ac-9a7a-988c14971d30
Fixes #16103