Closed prjseal closed 3 years ago
@prjseal Thank you for raising this. It's the list-editor that manages the multiple/single state of the value(s), so in this case it's the Buttons editor that uses an array.
The reason for this is for compatibility, between the other list-editors and if the configuration options are changed (e.g. if someone enabled the "Multiple selection?" option). Otherwise I'd be adding much more code to keep checking if the value was a string
or array
.
There is some automagic stuff going on at ValueConverter/ModelsBuilder level on whether to use a single or IEnumerable<>
, but at database/backoffice level, it's down to however the property-editor deals with it.
For your NestedContent name template, could you have appended [0]
, to get the first value from the array?
Closing this ticket, as it was done by design and not easily reworked.
Thanks for replying Lee, I was away at the weekend so didn't have chance to reply to you. This all makes sense.
I don't know if this is a bug or by design, but when i was using the user defined data source with a button picker as a single choice only, not multiple, it was storing the value as a json array instead of just a single string value. Then when I came to use that value as a name template in a nested content item I got
["myvalue"]
instead ofmyvalue
which made it look rubbish.I then decided to use the Umbraco built in radio button list instead and it worked.
So my question is, when it is a single item can you store it as a single string rather than a json array?