Problem/Motivation
There is a mismatch between EnumListPropType and its default source: CheckboxesWidget
Checkboxes widget allows an unique occurrence of each enum value, but the EnumListPropType schema allows multiple occurence.
Proposed resolution
- Introduce a new EnumSetPropType with is identical to EnumListPropType but with
uniqueItems: true - Make CheckboxesWidget the default widget of this new prop type
- Add a new SelectsWidget for EnumListPropType which will show a select element with the enum values for each array value.
Remaining tasks
Tell current users of UIP2 Beta4 they may need to change their current enum_list props by enum_set.
Issue fork ui_patterns-3486547
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
Comment #3
pdureau commentedWork in progress. Remaining work to do:
maxItemsComment #4
pdureau commentedCurrent status.
OOS:
maxItems>> NO, let's keep thing simpleTODO:
Comment #5
pdureau commentedDONE
Comment #6
just_like_good_vibes- the function
getAllowedValuesdoes not live well inPropTypePluginBaseandSourcePluginBasewith the namegetEnumOptions, let's rather put this in a trait,and use that trait in enum prop types and appropriate sources.
- there is a typo in "mixItems" in
CompatibilityCheckerotherwise i think this is quite a bold move.
Comment #7
pdureau commentedThanks you. Changes done.
I was not sure about the naming of the trait, so I did "EnumTrait"
Comment #8
pdureau commentedComment #9
just_like_good_vibesin
CompatibilityChecker,please change line 165 to
and put
priority: 1to EnumList prop type in its attributesComment #10
just_like_good_vibesComment #11
pdureau commentedI don't reproduce this on my environment. This is an
enum_list:This is an
enum_set:But we need to do some changes because it is better and safer to set priority attribute instead of relying on plugin discovery order, but 1 is already the default value and let's update both
enum_setandenum_list:enum(priority: 10) is also astring(priority: 1) or anumber(priority: 1)identifier(priority: 100) is also astring(priority: 1)url(priority: 10) is also astring(priority: 1)enum_set(priority: 10) is also aenum_list(priority: 1)Once the change done,
CompatibilityCheckermust also be updated. Thanks for your proposal, it works well.Comment #13
just_like_good_vibesComment #15
pdureau commentedLet's fix that in an otehr issue:
Each enum_set (priority: 10) is also a enum_list (priority: 5) which is also a list (priority: 1)