diff --git a/core/modules/field_ui/src/ConfigTranslation/EntityDisplaySubscriber.php b/core/modules/field_ui/src/ConfigTranslation/EntityDisplaySubscriber.php index 4039c5e..1b4c737 100644 --- a/core/modules/field_ui/src/ConfigTranslation/EntityDisplaySubscriber.php +++ b/core/modules/field_ui/src/ConfigTranslation/EntityDisplaySubscriber.php @@ -8,7 +8,7 @@ namespace Drupal\field_ui\ConfigTranslation; use Drupal\config_translation\ConfigEntityMapper; -use Drupal\config_translation\Event\ConfigMapperEvent; +use Drupal\config_translation\Event\ConfigMapperPopulateEvent; use Drupal\config_translation\Event\ConfigTranslationEvents; use Drupal\Core\Config\ConfigFactoryInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; @@ -39,18 +39,18 @@ public function __construct(ConfigFactoryInterface $config_factory) { /** * Reacts to the population of a configuration mapper. * - * @param \Drupal\config_translation\Event\ConfigMapperEvent $event + * @param \Drupal\config_translation\Event\ConfigMapperPopulateEvent $event * The configuration mapper event. * * @see \Drupal\field_ui\Routing\RouteSubscriber::alterRoutes() */ - public function onMapperPopulate(ConfigMapperEvent $event) { + public function onMapperPopulate(ConfigMapperPopulateEvent $event) { $mapper = $event->getMapper(); $base_route = $mapper->getBaseRoute(); if ( !($mapper instanceof ConfigEntityMapper) || - !($entity_type_id = $base_route->getOption('_field_ui_base_route')) + !($entity_type_id = $base_route->getOption('_field_ui_base_route_for')) ) { return; } @@ -59,6 +59,9 @@ public function onMapperPopulate(ConfigMapperEvent $event) { // Determine the bundle (if any) of the route. $bundle = NULL; if ($entity_type_id === $entity->getEntityType()->getBundleOf()) { + // Here, $entity is an extension of + // \Drupal\Core\Config\Entity\ConfigEntityBundleBase, + // so the entity's ID is a bundle name. $bundle = $entity->id(); } elseif ($base_route->getDefault('bundle')) { diff --git a/core/modules/field_ui/src/Routing/RouteSubscriber.php b/core/modules/field_ui/src/Routing/RouteSubscriber.php index de6a286..8fce3ba 100644 --- a/core/modules/field_ui/src/Routing/RouteSubscriber.php +++ b/core/modules/field_ui/src/Routing/RouteSubscriber.php @@ -45,23 +45,24 @@ protected function alterRoutes(RouteCollection $collection) { if (!$entity_route = $collection->get($route_name)) { continue; } + $path = $entity_route->getPath(); + + $options = $entity_route->getOptions(); + // Set a route option to easily identify all Field UI base routes and to // determine the entity type the route is for. - $entity_route->setOption('_field_ui_base_route', $entity_type_id); + $entity_route->setOption('_field_ui_base_route_for', $entity_type_id); // RouteCollection::add() overwrites exiting routes with the same name. $collection->add($route_name, $entity_route); - $path = $entity_route->getPath(); - - $options = $entity_route->getOptions(); if ($bundle_entity_type = $entity_type->getBundleEntityType()) { $options['parameters'][$bundle_entity_type] = array( 'type' => 'entity:' . $bundle_entity_type, ); } - // Set a route option to easily identify all Field UI base routes and to + // Set a route option to easily identify all Field UI routes and to // determine the entity type the routes are for. - $options['_field_ui_route'] = $entity_type_id; + $options['_field_ui_route_for'] = $entity_type_id; // This is retained for backwards-compatibility. // @todo Remove in Drupal 9 $options['_field_ui'] = TRUE;