function EntityViewBuilder::viewMultiple
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Entity/EntityViewBuilder.php \Drupal\Core\Entity\EntityViewBuilder::viewMultiple()
- 10 core/lib/Drupal/Core/Entity/EntityViewBuilder.php \Drupal\Core\Entity\EntityViewBuilder::viewMultiple()
- 11.x core/lib/Drupal/Core/Entity/EntityViewBuilder.php \Drupal\Core\Entity\EntityViewBuilder::viewMultiple()
Overrides EntityViewBuilderInterface::viewMultiple
2 calls to EntityViewBuilder::viewMultiple()
- BlockContentViewBuilder::viewMultiple in core/
modules/ block_content/ src/ BlockContentViewBuilder.php - Builds the render array for the provided entities.
- EntityViewBuilder::view in core/
lib/ Drupal/ Core/ Entity/ EntityViewBuilder.php - Builds the render array for the provided entity.
4 methods override EntityViewBuilder::viewMultiple()
- BlockContentViewBuilder::viewMultiple in core/
modules/ block_content/ src/ BlockContentViewBuilder.php - Builds the render array for the provided entities.
- BlockViewBuilder::viewMultiple in core/
modules/ block/ src/ BlockViewBuilder.php - Builds the render array for the provided entities.
- EntityTestViewBuilderOverriddenView::viewMultiple in core/
modules/ system/ tests/ modules/ entity_test/ src/ EntityTestViewBuilderOverriddenView.php - Builds the render array for the provided entities.
- TourViewBuilder::viewMultiple in core/
modules/ tour/ src/ TourViewBuilder.php - Builds the render array for the provided entities.
File
-
core/
lib/ Drupal/ Core/ Entity/ EntityViewBuilder.php, line 145
Class
- EntityViewBuilder
- Base class for entity view builders.
Namespace
Drupal\Core\EntityCode
public function viewMultiple(array $entities = [], $view_mode = 'full', $langcode = NULL) {
$build_list = [
'#sorted' => TRUE,
'#pre_render' => [
[
$this,
'buildMultiple',
],
],
];
$weight = 0;
foreach ($entities as $key => $entity) {
// Ensure that from now on we are dealing with the proper translation
// object.
$entity = $this->entityRepository
->getTranslationFromContext($entity, $langcode);
// Set build defaults.
$build_list[$key] = $this->getBuildDefaults($entity, $view_mode);
$entityType = $this->entityTypeId;
$this->moduleHandler()
->alter([
$entityType . '_build_defaults',
'entity_build_defaults',
], $build_list[$key], $entity, $view_mode);
$build_list[$key]['#weight'] = $weight++;
}
return $build_list;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.