X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Ffield_ui%2Fsrc%2FRouting%2FFieldUiRouteEnhancer.php;h=c7f0713b9452c8c785bcd1ea4e969a92922cc9af;hb=5b8bb166bfa98770daef9de5c127fc2e6ef02340;hp=b8307e5c98945608806b16df2c2294be7986f993;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/web/core/modules/field_ui/src/Routing/FieldUiRouteEnhancer.php b/web/core/modules/field_ui/src/Routing/FieldUiRouteEnhancer.php index b8307e5c9..c7f0713b9 100644 --- a/web/core/modules/field_ui/src/Routing/FieldUiRouteEnhancer.php +++ b/web/core/modules/field_ui/src/Routing/FieldUiRouteEnhancer.php @@ -3,14 +3,15 @@ namespace Drupal\field_ui\Routing; use Drupal\Core\Entity\EntityManagerInterface; -use Drupal\Core\Routing\Enhancer\RouteEnhancerInterface; +use Drupal\Core\Routing\EnhancerInterface; +use Symfony\Cmf\Component\Routing\RouteObjectInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Route; /** * Enhances Field UI routes by adding proper information about the bundle name. */ -class FieldUiRouteEnhancer implements RouteEnhancerInterface { +class FieldUiRouteEnhancer implements EnhancerInterface { /** * The entity manager. @@ -33,6 +34,10 @@ class FieldUiRouteEnhancer implements RouteEnhancerInterface { * {@inheritdoc} */ public function enhance(array $defaults, Request $request) { + if (!$this->applies($defaults[RouteObjectInterface::ROUTE_OBJECT])) { + return $defaults; + } + if (($bundle = $this->entityManager->getDefinition($defaults['entity_type_id'])->getBundleEntityType()) && isset($defaults[$bundle])) { // Field UI forms only need the actual name of the bundle they're dealing // with, not an upcasted entity object, so provide a simple way for them @@ -46,7 +51,7 @@ class FieldUiRouteEnhancer implements RouteEnhancerInterface { /** * {@inheritdoc} */ - public function applies(Route $route) { + protected function applies(Route $route) { return ($route->hasOption('_field_ui')); }