function RouteSubscriber::childRoutes
Same name in other branches
- 11.x core/modules/block_content/src/Routing/RouteSubscriber.php \Drupal\block_content\Routing\RouteSubscriber::childRoutes()
Creates a list of routes that need BC redirects.
Parameters
\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type.
Return value
string[] A list of route names.
1 call to RouteSubscriber::childRoutes()
- RouteSubscriber::alterRoutes in core/
modules/ block_content/ src/ Routing/ RouteSubscriber.php - Alters existing routes for a specific collection.
File
-
core/
modules/ block_content/ src/ Routing/ RouteSubscriber.php, line 169
Class
- RouteSubscriber
- Subscriber for Block content BC routes.
Namespace
Drupal\block_content\RoutingCode
protected function childRoutes(EntityTypeInterface $entity_type) : array {
$route_names = [];
if ($field_ui_base_route = $entity_type->get('field_ui_base_route')) {
$updated_routes = new RouteCollection();
$updated_routes->add($field_ui_base_route, $this->collection
->get($field_ui_base_route));
$event = new RouteBuildEvent($updated_routes);
// Apply route subscribers that add routes based on field_ui_base_route,
// in the order of their weights.
$subscribers = [
'field_ui' => 'field_ui.subscriber',
'content_translation' => 'content_translation.subscriber',
];
foreach ($subscribers as $module_name => $service_name) {
if ($this->moduleHandler
->moduleExists($module_name)) {
\Drupal::service($service_name)->onAlterRoutes($event);
}
}
$updated_routes->remove($field_ui_base_route);
$route_names = array_merge($route_names, array_keys($updated_routes->all()));
$route_names = array_merge($route_names, [
// @see \Drupal\config_translation\Routing\RouteSubscriber::alterRoutes()
"config_translation.item.add.{$field_ui_base_route}",
"config_translation.item.edit.{$field_ui_base_route}",
"config_translation.item.delete.{$field_ui_base_route}",
]);
}
if ($entity_type_id = $entity_type->getBundleEntityType()) {
$route_names = array_merge($route_names, [
// @see \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider::getRoutes()
"entity.{$entity_type_id}.delete_form",
// @see \Drupal\config_translation\Routing\RouteSubscriber::alterRoutes()
"entity.{$entity_type_id}.config_translation_overview",
// @see \Drupal\user\Entity\EntityPermissionsRouteProvider::getRoutes()
"entity.{$entity_type_id}.entity_permissions_form",
]);
}
if ($entity_id = $entity_type->id()) {
$route_names = array_merge($route_names, [
// @see \Drupal\config_translation\Routing\RouteSubscriber::alterRoutes()
"entity.field_config.config_translation_overview.{$entity_id}",
"config_translation.item.add.entity.field_config.{$entity_id}_field_edit_form",
"config_translation.item.edit.entity.field_config.{$entity_id}_field_edit_form",
"config_translation.item.delete.entity.field_config.{$entity_id}_field_edit_form",
// @see \Drupal\layout_builder\Plugin\SectionStorage\DefaultsSectionStorage::buildRoutes()
"layout_builder.defaults.{$entity_id}.disable",
"layout_builder.defaults.{$entity_id}.discard_changes",
"layout_builder.defaults.{$entity_id}.view",
]);
}
return $route_names;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.