function LayoutBuilderEntityViewDisplay::buildMultiple
Same name in other branches
- 9 core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php \Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay::buildMultiple()
- 10 core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php \Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay::buildMultiple()
- 11.x core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php \Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay::buildMultiple()
Overrides EntityViewDisplay::buildMultiple
File
-
core/
modules/ layout_builder/ src/ Entity/ LayoutBuilderEntityViewDisplay.php, line 266
Class
- LayoutBuilderEntityViewDisplay
- Provides an entity view display entity that has a layout.
Namespace
Drupal\layout_builder\EntityCode
public function buildMultiple(array $entities) {
$build_list = parent::buildMultiple($entities);
// Layout Builder can not be enabled for the '_custom' view mode that is
// used for on-the-fly rendering of fields in isolation from the entity.
if ($this->isCustomMode()) {
return $build_list;
}
foreach ($entities as $id => $entity) {
$build_list[$id]['_layout_builder'] = $this->buildSections($entity);
// If there are any sections, remove all fields with configurable display
// from the existing build. These fields are replicated within sections as
// field blocks by ::setComponent().
if (!Element::isEmpty($build_list[$id]['_layout_builder'])) {
foreach ($build_list[$id] as $name => $build_part) {
$field_definition = $this->getFieldDefinition($name);
if ($field_definition && $field_definition->isDisplayConfigurable($this->displayContext)) {
unset($build_list[$id][$name]);
}
}
}
}
return $build_list;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.