I'm wondering if there is a way to theme the default style for the webform token [webform_submission:values].

The emails being sent with no space between the label and the value.
So they look like this: Example LableExample Value

I just want to add a semicolon and a space after the label.
Is that possible without having to use a custom body for every webform?
Like this: Name: [submission:values:name:nolabel]

  • FYI, I'm using webform 5.0 and Drupal 8.6.2. – aolsen356 Jan 9 at 20:35
  • Are you sending HTML emails or plain text? HTML emails should be formatted with bold labels and breaks. Plain text should have colons and returns. @see webform-element-base-text.html.twig and webform-element-base-html.html.twig. It is possible that your email sender is stripping HTML tags. – jrockowitz Jan 9 at 21:08
  • Thanks. I've verified that that is indeed the file being used, no other template is overriding it, so there must be something else stripping tags. Thanks for pointing me in the right direction! I appreciate it. – aolsen356 Jan 9 at 21:26
  • I found what is stripping tags. There is a custom module that runs the message body through Xss::filter(), like this -> $body = Xss::filter($body). Do you think I'm safe to remove this filter? – aolsen356 Jan 9 at 21:48
  • For email messages, you generally don't need to filter the content. To be safe you might want to use Xss::filterAdmin($body). The specific issue here is the default HTML tags for Xss::filter are don't include <b> or <br/>. @see \Drupal\Component\Utility\Xss::$htmlTags – jrockowitz Jan 9 at 23:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.