How To Override Webform's Submission Template in Drupal 8 The template provided by the Webform module for theming a submission is rather plain. Basically, it looks like a print_r of the data variable. If you try to add HTML to validation function before it gets submitted, the HTML just gets rendered as plain text.

So I was trying to find a way to override the template from a module as opposed to a theme. I'm not able to find much documentation for this right now.

How do I override webform's default submission HTML template from a module?
Create a custom module and in the custom.module file add this code:

/**
 * Implements hook_theme_registry_alter
 */
function custom_theme_registry_alter(&amp;$theme_registry) {
  $theme_registry['webform_submission_html']['path'] = drupal_get_path('module', 'custom') . '/templates';
  $theme_registry['webform_submission_html']['template'] = 'custom-submission-html';
}


You should have in the custom module your template at the location custom/templates/custom-submission-html.html.twig

The contents of that Twig file look like this.

{{ data }}
{{ data.r }}
{{ data.n }}


You can add HTML that suits your specific case.