- Issue created by @arwillame
- Merge request !502Issue #3520788 by arwillame, jurgenhaas, tim-diels: Set raw Field value → (Closed) created by arwillame
- 🇩🇪Germany jurgenhaas Gottmadingen
I may be wrong, but I guess we don't need this. And it would be insufficient to only provide raw token values for one out of so many use cases for tokens.
If the memory serves correct, then you can just suffix the token name with
:raw
to get the raw value, e.g.[node:title:raw]
- 🇧🇪Belgium tim-diels Belgium 🇧🇪
I tried looking where to get the
:raw
token, but thats not available except for the date field or the webform module that provided their own integration.I tracked it down to having the entity label set from the group title/label with special characters return a html encoded string. We do not need an extra plugin to get the raw value but maybe we can do
htmlspecialchars_decode
on the entity label set from a token?So in the class
NewEntity
in the methodexecute
we can replace the following:if (isset($entity_keys['label']) && isset($config['label'])) { $values[$entity_keys['label']] = trim((string) $this->tokenService->replace($config['label'], [], ['clear' => TRUE])); }
with
if (isset($entity_keys['label']) && isset($config['label'])) { $values[$entity_keys['label']] = htmlspecialchars_decode(trim((string) $this->tokenService->replace($config['label'], [], ['clear' => TRUE]))); }
- 🇩🇪Germany jurgenhaas Gottmadingen
So in the classNewEntity in the method execute we can replace the following
This would be an approach which solves something in one single place, which will not what we're doing in ECA. Tokens should behave similarly everywhere, not just for a single action plugin.
I tried looking where to get the :raw token, but thats not available except for the date field or the webform module that provided their own integration.
My memory was fooling me. What we have been implementing is not the
:raw
suffix, it's theplain:
prefix. Details can be found at 📌 String token values get returned as markup casted back to string Fixed .So, when looking at the token browser, you find the "plain" token there which can be used together with any existing token:
- 🇧🇪Belgium tim-diels Belgium 🇧🇪
Hi Jurgen, thanks for the great support here. I finally was able to come back to this and you're absolutely correct in your explanation to use the
plain:
token. Thank you so much for the help! - 🇧🇪Belgium tim-diels Belgium 🇧🇪
I can't close the MR so left issue open for now. Can you close it?
- 🇩🇪Germany jurgenhaas Gottmadingen
Thanks @tim-diels for reporting this in the first place and then your follow-ups, this is much appreciated. There's always something to learn from these types of issues, for everybody.