Problem/Motivation

auto_entitylabel module automatically escapes double quotes (ie. ") effectively not supporting this module.

Steps to reproduce

- enable auto_entitylabel and token_or modules
- create auto_entitylabel token pattern and utilize token_or fallback string, ex. [node:tags|"Tag"]
- see that if field tags don't have a value, the token will result in an empty string. Expacted output is "Tag".

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

zaporylie created an issue. See original summary.

zaporylie’s picture

Title: compatibility with auto_entitylabel » Compatibility with auto_entitylabel
Related issues: +#3542021: Compatibility with token_or
zaporylie’s picture

One way to support this would be to create a generic, dynamic [fallback_value:*] dynamic token, which will stop relying on the double quotes.

pianomansam’s picture

@zaporylie Sorry to hear about this issue. Thanks for reporting it. I'll look into how auto_entitylabel implements token replacement. If there's a way we can resolve it on that side, we would avoid a breaking change on the token_or side. In the meantime, you're welcome to submit a fix.

zaporylie’s picture

auto_entitylabel module uses tokens within TranslatableMarkup's placeholder ('@placeholder'), which is what's causing this issue in the first place.

If we add support for an alternative fallback string dynamic replacement token we could leave the old logic in place but document how to use new syntax, gradually deprecating old syntax.

Currently, I solved it like that in the project's custom codebase, and this solution is working well. Whitespaces are supported in case that's someone's concern.

Please also notice that a similar issue was created in auto_entitylabel module, link in Related issues.

IMHO both modules could benefit from improvements: token_or could stop relying on quotes which would also resolve #3380978: Allow to use ' as enclosure for using in href attributes while auto_entitylabel should stop using TranslatableMarkup in favour of having a translatable config entity.