- Issue created by @nofue
- 🇬🇧United Kingdom adamps
As far as I can see this has been like this since the start of the D8 branch. The code is in
MailEntity::getBodyWithFormat()
. Passing the 'clear' option to token replace would fix it to work how you want. - 🇬🇧United Kingdom adamps
In $options when calling
\Drupal::token()->replace()
.It's strange - I would expect [entity:field_xxx] to return blank if the field was empty and that it would only get left in when the field didn't even exist on that entity.
- 🇨🇭Switzerland berdir Switzerland
There's an issue for that in the token module.
- 🇬🇧United Kingdom adamps
Thanks @Berdir - I guess it's this issue: #2648180: Replace field tokens by empty strings when there is no field value →
So maybe we close this one as "working as designed" and anyone interested can put a patch for the token module fix?
- 🇦🇹Austria nofue
Well, seems the token field issue has't been resolved in years, so I'm not going to give that a try. I rather write module which puts all the filled in fields from the subscription form in the right order to make for a single valid greeting field … Thanks for the heads up anyway, maybe I get good enough with coding to tackle that issue in the token module - but please don't hold your breath.