Problem/Motivation
When previewing a webform, any CSS classes added to the webform via the Advanced tab of the element is not displayed.
A code snippet from the form page.
<div id="edit-terms-of-this-booking" class="fieldset-walton form-item js-form-item form-wrapper js-form-wrapper panel panel-default">
The same snippet from the preview page.
<div id="bookings--terms_of_this_booking" class="webform-container webform-container-type-fieldset form-item js-form-item form-wrapper js-form-wrapper panel panel-default">
As you can see, the custom CSS class fieldset-walton is not included in the class list. This means that any classes added are not included in the preview and maybe not included in the email that is submitted after I click the Submit button.
I have attached the exported yml file.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | 3014769-8.patch | 18.69 KB | jrockowitz |
| #4 | Screen Shot 2018-11-19 at 10.34.25 AM.png | 47.68 KB | jrockowitz |
| #4 | 3014769-4.patch | 12.91 KB | jrockowitz |
| webform.webform.bookings.yml | 20.09 KB | taxicab221 |
Comments
Comment #2
jrockowitz commentedThe element and wrapper classes are only for form display. To customize the preview and email display you will need to use your theme to alter the templates.
Comment #3
jrockowitz commentedI would be open to adding
#display_attributessupport to thewebform-element-base-html.html.twigtemplate viatemplate_preprocess_webform_element_base_html().Keep in mind that the markup for HTML emails is very basic and does not rely on CSS classes.
Comment #4
jrockowitz commentedThe attached patch adds support for Display wrapper attributes (#format_attributes)
Comment #5
taxicab221 commentedThanks for your prompt reply. Will apply the patch and learn how to write twig templates.
Fantastic module by the way. Looking forward to many more enhancements.
Comment #6
jrockowitz commentedComment #8
jrockowitz commentedComment #9
jrockowitz commentedComment #11
jrockowitz commented