You are here

function template_preprocess_yamlform_submission_yaml in YAML Form 8

Prepares variables for form submission YAML template.

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

Parameters

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

  • yamlform_submission: A form submission.

File

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

Code

function template_preprocess_yamlform_submission_yaml(array &$variables) {

  /** @var \Drupal\yamlform\YamlFormSubmissionInterface $yamlform_submission */
  $yamlform_submission = $variables['yamlform_submission'];
  $data = $yamlform_submission
    ->toArray(TRUE);
  $yaml = Yaml::encode($data);
  $yaml = YamlFormTidy::tidy($yaml);
  $variables['yaml'] = [
    '#markup' => $yaml,
    '#allowed_tags' => Xss::getAdminTagList(),
  ];
}