public function YamlFormSubmissionViewBuilder::buildComponents in YAML Form 8
Builds the component fields and properties of a set of entities.
Parameters
&$build: The renderable array representing the entity content.
\Drupal\Core\Entity\EntityInterface[] $entities: The entities whose content is being built.
\Drupal\Core\Entity\Display\EntityViewDisplayInterface[] $displays: The array of entity view displays holding the display options configured for the entity components, keyed by bundle name.
string $view_mode: The view mode in which the entity is being viewed.
Overrides EntityViewBuilder::buildComponents
File
- src/
YamlFormSubmissionViewBuilder.php, line 103
Class
- YamlFormSubmissionViewBuilder
- Render controller for form submissions.
Namespace
Drupal\yamlformCode
public function buildComponents(array &$build, array $entities, array $displays, $view_mode) {
/** @var \Drupal\yamlform\YamlFormSubmissionInterface[] $entities */
/** @var \Drupal\yamlform\YamlFormSubmissionInterface $yamlform_submission */
if (empty($entities)) {
return;
}
$source_entity = $this->requestManager
->getCurrentSourceEntity('yamlform_submission');
parent::buildComponents($build, $entities, $displays, $view_mode);
// If the view mode is default then display the HTML version.
if ($view_mode == 'default') {
$view_mode = 'html';
}
// Build submission display.
foreach ($entities as $id => $yamlform_submission) {
$build[$id]['submission'] = [
'#theme' => 'yamlform_submission_' . $view_mode,
'#yamlform_submission' => $yamlform_submission,
'#source_entity' => $source_entity,
];
}
}