You are here

protected function WebformSubmissionViewBuilder::getBuildDefaults in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/WebformSubmissionViewBuilder.php \Drupal\webform\WebformSubmissionViewBuilder::getBuildDefaults()

Provides entity-specific defaults to the build process.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity for which the defaults should be provided.

string $view_mode: The view mode that should be used.

Return value

array

Overrides EntityViewBuilder::getBuildDefaults

File

src/WebformSubmissionViewBuilder.php, line 83

Class

WebformSubmissionViewBuilder
Render controller for webform submissions.

Namespace

Drupal\webform

Code

protected function getBuildDefaults(EntityInterface $entity, $view_mode) {
  $build = parent::getBuildDefaults($entity, $view_mode);

  // The webform submission will be rendered in the wrapped webform submission
  // template already. Instead we are going to wrap the rendered submission
  // in a webform submission data template.
  // @see \Drupal\contact_storage\ContactMessageViewBuilder
  // @see \Drupal\comment\CommentViewBuilder::getBuildDefaults
  // @see \Drupal\block_content\BlockContentViewBuilder::getBuildDefaults
  // @see webform-submission-data.html.twig
  $build['#theme'] = 'webform_submission_data';
  return $build;
}