function OverridesSectionStorage::buildRoutes
Same name in other branches
- 9 core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php \Drupal\layout_builder\Plugin\SectionStorage\OverridesSectionStorage::buildRoutes()
- 8.9.x core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php \Drupal\layout_builder\Plugin\SectionStorage\OverridesSectionStorage::buildRoutes()
- 11.x core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php \Drupal\layout_builder\Plugin\SectionStorage\OverridesSectionStorage::buildRoutes()
Overrides SectionStorageInterface::buildRoutes
File
-
core/
modules/ layout_builder/ src/ Plugin/ SectionStorage/ OverridesSectionStorage.php, line 226
Class
- OverridesSectionStorage
- Defines the 'overrides' section storage type.
Namespace
Drupal\layout_builder\Plugin\SectionStorageCode
public function buildRoutes(RouteCollection $collection) {
foreach ($this->getEntityTypes() as $entity_type_id => $entity_type) {
// If the canonical route does not exist, do not provide any Layout
// Builder UI routes for this entity type.
if (!$collection->get("entity.{$entity_type_id}.canonical")) {
continue;
}
$defaults = [];
$defaults['entity_type_id'] = $entity_type_id;
// Retrieve the requirements from the canonical route.
$requirements = $collection->get("entity.{$entity_type_id}.canonical")
->getRequirements();
$options = [];
// Ensure that upcasting is run in the correct order.
$options['parameters']['section_storage'] = [];
$options['parameters'][$entity_type_id]['type'] = 'entity:' . $entity_type_id;
$options['_admin_route'] = FALSE;
$template = $entity_type->getLinkTemplate('canonical') . '/layout';
$this->buildLayoutRoutes($collection, $this->getPluginDefinition(), $template, $defaults, $requirements, $options, $entity_type_id, $entity_type_id);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.