You are here

public static function WebformSubmissionInformation::preRenderWebformSubmissionInformation in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Element/WebformSubmissionInformation.php \Drupal\webform\Element\WebformSubmissionInformation::preRenderWebformSubmissionInformation()

Create webform submission information for rendering.

Parameters

array $element: An associative array containing the properties and children of the element.

Return value

array The modified element with webform submission information.

File

src/Element/WebformSubmissionInformation.php, line 42

Class

WebformSubmissionInformation
Provides a render element to display webform submission information.

Namespace

Drupal\webform\Element

Code

public static function preRenderWebformSubmissionInformation(array $element) {

  /** @var \Drupal\webform\WebformSubmissionInterface $webform_submission */
  $webform_submission = $element['#webform_submission'];
  $webform = $webform_submission
    ->getWebform();

  // Add title.
  $element += [
    '#title' => t('Submission information'),
  ];

  // Add details attributes.
  $element['#attributes']['data-webform-element-id'] = $webform
    ->id() . '-submission-information';
  $element['#attributes']['class'] = [
    'webform-submission-information',
  ];
  return $element;
}