You are here

function template_preprocess_webform_submission_data in Webform 6.x

Same name and namespace in other branches
  1. 8.5 includes/webform.theme.template.inc \template_preprocess_webform_submission_data()

Prepares variables for webform submission data templates.

Default template: webform-submission-data.html.twig.

Parameters

array $variables: An associative array containing:

  • data: An array of elements to display in view mode.
  • webform_submission: The webform submissions object.
  • view_mode: View mode; e.g., 'html', 'text', 'table', 'yaml', etc.

File

includes/webform.theme.template.inc, line 285
Preprocessors and helper functions to make theming easier.

Code

function template_preprocess_webform_submission_data(array &$variables) {
  $variables['view_mode'] = $variables['elements']['#view_mode'];
  $variables['webform_submission'] = $variables['elements']['#webform_submission'];
  if ($variables['webform_submission'] instanceof WebformSubmissionInterface) {
    $variables['webform'] = $variables['webform_submission']
      ->getWebform();
  }
}