Configurate text and value for prevalues in dropdown #11084
Replies: 4 comments 2 replies
-
Regarding color picker devlopers may just use the color code directly as inline styles in frontend, while in other scenarios it makes more sence the store a different value like a value used as class name or data attribute value. Currently we would have to either transform the color in view or controller, create our own color picker property editor or use a package like Contentment. |
Beta Was this translation helpful? Give feedback.
-
I was just about to write my own editors to do this exact thing. I don’t think I ever use dropdowns, radio buttons or checkboxes without having to parse them in the view. More often than not I also have to code a fall back value if nothing was selected. I would like be able to:
|
Beta Was this translation helpful? Give feedback.
-
@iOvergaard @nielslyngsoe in the new backoffice the multivalues property editors currently expect a string arrary, e.g. a config like this:
it would be useful if these can support E.g. Approved Color has this configuration:
|
Beta Was this translation helpful? Give feedback.
-
I was thinking a multi values property editor / component will be useful in both core, but also packages or when extending backoffice UI, mainly label/value or key/value and the (approved) color picker may be able to extend this. For our projects we also have a custom Button Picker property editor, which allow to set an (optional) icon, (optional) label and (required) value. Perhaps it makes sense to have a flexible multi values property editor and pass in an array of objects (similar to settings property in configuration of a property editor). Scenario 1: Label/value for lists (dropdown, radiobutton, checkbox)
Scenario 2: Crop dimensions
Scenario 3: Currencies
Scenario 4: Button Picker
It would allow to re-use much of the existing property editor UIs and pre-configure items in the content type property. Of course it doesn't cover every use-case, but it allow to pre-configure items in a property editor setting property, where each object value not necessary is a textbox/string. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In property editors like dropdown, checkbox list and radiobutton list we can configurate prevalues.
However currently there is no way to configurate both text and value and also default selected option(s).
Often you don't want the label is the same as the stored value, but currently we may need to resolve the value in e.g. razor view, so
None
would be mapped to a value likeg-0
(no gutter).It would could specify the specific value (which editors don't see), it would in many cases require less code in views.
Not sure what the best approach would be, but it could be something like this with toggles. By default it could generate a lowercase value from the label/text and replace e.g. space with hyphen.
and a bit similar to color picker which allow to specific value and label.
Beta Was this translation helpful? Give feedback.
All reactions