function LayoutBuilderEntityViewDisplay::getRuntimeSections
Gets the runtime sections for a given entity.
Parameters
\Drupal\Core\Entity\FieldableEntityInterface $entity: The entity.
Return value
\Drupal\layout_builder\Section[] The sections.
Deprecated
in drupal:8.7.0 and is removed from drupal:9.0.0. \Drupal\layout_builder\SectionStorage\SectionStorageManagerInterface::findByContext() should be used instead. See https://www.drupal.org/node/3022574.
File
-
core/
modules/ layout_builder/ src/ Entity/ LayoutBuilderEntityViewDisplay.php, line 357
Class
- LayoutBuilderEntityViewDisplay
- Provides an entity view display entity that has a layout.
Namespace
Drupal\layout_builder\EntityCode
protected function getRuntimeSections(FieldableEntityInterface $entity) {
@trigger_error('\\Drupal\\layout_builder\\Entity\\LayoutBuilderEntityViewDisplay::getRuntimeSections() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. \\Drupal\\layout_builder\\SectionStorage\\SectionStorageManagerInterface::findByContext() should be used instead. See https://www.drupal.org/node/3022574.', E_USER_DEPRECATED);
// For backwards compatibility, mimic the functionality of ::buildSections()
// by constructing a cacheable metadata object and retrieving the
// entity-based contexts.
$cacheability = new CacheableMetadata();
$contexts = $this->getContextsForEntity($entity);
$storage = $this->sectionStorageManager()
->findByContext($contexts, $cacheability);
return $storage ? $storage->getSections() : [];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.