diff --git a/core/modules/field_ui/src/Routing/RouteSubscriber.php b/core/modules/field_ui/src/Routing/RouteSubscriber.php index f31ff2b6bbc70291cbd56b7d757d7017bd5180ac..8f1b8f1fced51e25f95ef871e28738524ce5dad1 100644 --- a/core/modules/field_ui/src/Routing/RouteSubscriber.php +++ b/core/modules/field_ui/src/Routing/RouteSubscriber.php @@ -47,7 +47,7 @@ protected function alterRoutes(RouteCollection $collection) { } $path = $entity_route->getPath(); - $options = array(); + $options = $entity_route->getOptions(); if ($bundle_entity_type = $entity_type->getBundleEntityType()) { $options['parameters'][$bundle_entity_type] = array( 'type' => 'entity:' . $bundle_entity_type, diff --git a/core/modules/field_ui/src/Tests/FieldUIRouteTest.php b/core/modules/field_ui/src/Tests/FieldUIRouteTest.php index 332a87d86c035bc421faad41f40470c904fe66f2..6b680430e5089f9988727c561d7c44698666bef9 100644 --- a/core/modules/field_ui/src/Tests/FieldUIRouteTest.php +++ b/core/modules/field_ui/src/Tests/FieldUIRouteTest.php @@ -112,4 +112,13 @@ public function assertLocalTasks() { $this->assertLink('Manage form display'); } + /** + * Asserts that admin routes are correctly marked as such. + */ + public function testAdminRoute() { + $route = \Drupal::service('router.route_provider')->getRouteByName('entity.entity_test.field_ui_fields'); + $is_admin = \Drupal::service('router.admin_context')->isAdminRoute($route); + $this->assertTrue($is_admin, 'Admin route correctly marked for "Manage fields" page.'); + } + } diff --git a/core/modules/system/tests/modules/entity_test/src/Routing/EntityTestRoutes.php b/core/modules/system/tests/modules/entity_test/src/Routing/EntityTestRoutes.php index 3a5bbe95b02b1999ae28e8069f02a69b1ebad651..09d677f1864e34b6cff00fb06b75d849d8f8df8f 100644 --- a/core/modules/system/tests/modules/entity_test/src/Routing/EntityTestRoutes.php +++ b/core/modules/system/tests/modules/entity_test/src/Routing/EntityTestRoutes.php @@ -60,7 +60,8 @@ public function routes() { $routes["entity.$entity_type_id.admin_form"] = new Route( "$entity_type_id/structure/{bundle}", array('_controller' => '\Drupal\entity_test\Controller\EntityTestController::testAdmin'), - array('_permission' => 'administer entity_test content') + array('_permission' => 'administer entity_test content'), + array('_admin_route' => TRUE) ); } return $routes;