Orchard icon indicating copy to clipboard operation
Orchard copied to clipboard

It is not possible to use tokens with Options text in Enumeration Element

Open jersiovic opened this issue 8 years ago • 8 comments

Currently Options property in an Enumeration Element expects you separate text from value with two colon: "Option 1:1". So it splits each line using character ':' Problems arise when you want to use a token to get text of the option and this token needs a parameter because it also uses a two point character ':'. So it would better Enumeration element expects a different character than ':' like for example '|'

jersiovic avatar Apr 25 '16 06:04 jersiovic

Perhaps both characters need to be supported as to not break existing sites that use the colon?

sfmskywalker avatar Apr 25 '16 06:04 sfmskywalker

So it could look for '|' char and if not exist try with old one. Is it ok?

jersiovic avatar Apr 25 '16 09:04 jersiovic

Exactly.

sfmskywalker avatar Apr 25 '16 09:04 sfmskywalker

PR fixed

jersiovic avatar Apr 25 '16 11:04 jersiovic

What is the text or the value needs to contains a |, will I need to create a PR to use a different char? I think the solution is to encode the : and to be explicit in the description to use :: to render one.

sebastienros avatar Apr 28 '16 19:04 sebastienros

@sebastienros the use-case @jersiovic mentioned above is the usage of a token - I'd prefer your recommendation too btw, because it doesn't break existing configuration (when token's aren't used).

BenedekFarkas avatar Aug 22 '19 17:08 BenedekFarkas

Wan we switch the element to use | but it would mean to create a migration too.

sebastienros avatar Aug 22 '19 19:08 sebastienros

Actually, we can detect that a : corresponds to a Token and not a separator, because Tokens are between { and } characters. So we might be able to implement this without having to change what you type in the field, just make the deserialization smarter.

BenedekFarkas avatar Aug 23 '19 09:08 BenedekFarkas