You are here

function _webform_entity_print_preprocess_entity_print_get_webform_submission in Webform 6.x

Same name and namespace in other branches
  1. 8.5 modules/webform_entity_print/webform_entity_print.module \_webform_entity_print_preprocess_entity_print_get_webform_submission()

Get webform submission from entity print variables.

Parameters

array $variables: An associative array of entity print template variables.

Return value

\Drupal\webform\WebformSubmissionInterface|null A webform submission or NULL.

1 call to _webform_entity_print_preprocess_entity_print_get_webform_submission()
webform_entity_print_preprocess_entity_print in modules/webform_entity_print/webform_entity_print.module
Implements hook_preprocess_entity_print().

File

modules/webform_entity_print/webform_entity_print.module, line 316
Provides Entity Print (PDF) integration.

Code

function _webform_entity_print_preprocess_entity_print_get_webform_submission(array $variables) {
  foreach ($variables as $key => $value) {
    if ($key === '#webform_submission' && $value instanceof WebformSubmissionInterface) {
      return $value;
    }
    elseif (!is_array($value)) {
      continue;
    }
    elseif ($webform_submission = _webform_entity_print_preprocess_entity_print_get_webform_submission($value)) {
      return $webform_submission;
    }
  }
}