protected function PanelizerEntityViewBuilder::buildMultiplePanelized in Panelizer 8.3
Same name and namespace in other branches
- 8.5 src/PanelizerEntityViewBuilder.php \Drupal\panelizer\PanelizerEntityViewBuilder::buildMultiplePanelized()
- 8.4 src/PanelizerEntityViewBuilder.php \Drupal\panelizer\PanelizerEntityViewBuilder::buildMultiplePanelized()
Build the render array for a list of panelized entities.
Parameters
\Drupal\Core\Entity\EntityInterface[] $entities:
\Drupal\Core\Entity\Display\EntityViewDisplayInterface[] $displays:
string $view_mode:
string|NULL $langcode:
Return value
array
2 calls to PanelizerEntityViewBuilder::buildMultiplePanelized()
- PanelizerEntityViewBuilder::view in src/
PanelizerEntityViewBuilder.php - Builds the render array for the provided entity.
- PanelizerEntityViewBuilder::viewMultiple in src/
PanelizerEntityViewBuilder.php - Builds the render array for the provided entities.
File
- src/
PanelizerEntityViewBuilder.php, line 348
Class
- PanelizerEntityViewBuilder
- Entity view builder for entities that can be panelized.
Namespace
Drupal\panelizerCode
protected function buildMultiplePanelized(array $entities, array $displays, $view_mode, $langcode) {
$build = [];
foreach ($entities as $id => $entity) {
$panels_display = $this->panelizer
->getPanelsDisplay($entity, $view_mode, $displays[$entity
->bundle()]);
$settings = $this->panelizer
->getPanelizerSettings($entity
->getEntityTypeId(), $entity
->bundle(), $view_mode, $displays[$entity
->bundle()]);
$panels_display
->setContexts($this->panelizer
->getDisplayStaticContexts($settings['default'], $entity
->getEntityTypeId(), $entity
->bundle(), $view_mode, $displays[$entity
->bundle()]));
$build[$id] = $this
->buildPanelized($entity, $panels_display, $view_mode, $langcode);
// Allow modules to modify the render array.
$alter_types = [
"{$this->entityTypeId}_view",
'entity_view',
];
$this->moduleHandler
->alter($alter_types, $build[$id], $entity, $displays[$entity
->bundle()]);
}
return $build;
}