diff --git a/core/modules/field_ui/src/ConfigTranslation/EntityDisplaySubscriber.php b/core/modules/field_ui/src/ConfigTranslation/EntityDisplaySubscriber.php index 1d6042b..7a53946 100644 --- a/core/modules/field_ui/src/ConfigTranslation/EntityDisplaySubscriber.php +++ b/core/modules/field_ui/src/ConfigTranslation/EntityDisplaySubscriber.php @@ -45,27 +45,26 @@ public function __construct(ConfigFactoryInterface $config_factory) { * @see \Drupal\field_ui\Routing\RouteSubscriber::alterRoutes() */ public function onMapperPopulate(ConfigMapperPopulateEvent $event) { + $bundle = NULL; $mapper = $event->getMapper(); $base_route = $mapper->getBaseRoute(); - if ( - !($mapper instanceof ConfigEntityMapper) || - !($base_route->hasOption('_field_ui_base_route')) - ) { + if (!($base_route->hasOption('_field_ui_base_route'))) { return; } - $entity = $mapper->getEntity(); - $entity_type_id = $base_route->getOption('_field_ui_entity_type_id'); - // 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(); + $entity_type_id = $base_route->getOption('_field_ui_entity_type_id'); + if ($mapper instanceof ConfigEntityMapper) { + $entity = $mapper->getEntity(); + 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')) { + + if (!$bundle && $base_route->getDefault('bundle')) { $bundle = $base_route->getDefault('bundle'); } @@ -82,7 +81,6 @@ public function onMapperPopulate(ConfigMapperPopulateEvent $event) { $mapper->addConfigName($config_name); } } - } /**