enonic / app-contentstudio-old

Enonic XP - Content Studio app
GNU General Public License v3.0
1 stars 1 forks source link

Support template literals in content-display-name-script #536

Closed alansemenov closed 5 years ago

alansemenov commented 6 years ago

@ComLock commented on Tue Oct 30 2018

This: https://xp.readthedocs.io/en/stable/developer/site/content-types/custom-types.html

Contains the following example:

<content-display-name-script>$('firstName', ' ', 'lastName')</content-display-name-script>

Which seems to indicate a space character is inserted between the firstName and lastName.

However if you try:

<content-display-name-script>$('Hardcoded text ', 'fieldName')</content-display-name-script>

The 'Hardcoded text ' disappears and only the content of the field with the name fieldName is added.

The syntax is rather bad in terms of what is a variable and whats not.

Tried this too without any luck:

<content-display-name-script>Hardcoded text $('fieldName')</content-display-name-script>

@alansemenov commented on Tue Nov 06 2018

Docs are wrong - you cannot use empty string or space or hardcoded string or anything but a field name. However, in 7.0 we will support ES template literals - you will be able to write something like

<content-display-name-script>Hardcoded ${firstName} ${lastName} string</content-display-name-script>