You are here

function template_preprocess_yamlform_submission_html in YAML Form 8

Prepares variables for form submission HTML template.

Default template: yamlform-submission-html.html.twig.

Parameters

array $variables: An associative array containing the following key:

  • yamlform_submission: A form submission.

File

includes/yamlform.theme.inc, line 300
Preprocessors and helper functions to make theming easier.

Code

function template_preprocess_yamlform_submission_html(array &$variables) {

  /** @var \Drupal\yamlform\YamlFormSubmissionInterface $yamlform_submission */
  $yamlform_submission = $variables['yamlform_submission'];

  /** @var \Drupal\yamlform\YamlFormSubmissionViewBuilderInterface $view_builder */
  $view_builder = \Drupal::entityTypeManager()
    ->getViewBuilder('yamlform_submission');
  $yamlform = $yamlform_submission
    ->getYamlForm();
  $data = $yamlform_submission
    ->getData();
  $elements = $yamlform
    ->getElementsInitialized();
  $variables['data'] = $view_builder
    ->buildElements($elements, $data);
}