$collection = $event->getRouteCollection(); $route = new Route("$path/display", array('_form' => '\Drupal\field_ui\DisplayOverview') + $defaults, array('_permission' => 'administer ' . $entity_type . ' display')); $collection->add("field_ui.display_overview.$entity_type", $route);
There is also a
RoutingEvents::ALTER event, which runs afterward.
You can think of the difference between
RoutingEvents::ALTER as similar to the difference between
There is a Views issue that discusses replacing routes, as opposed to removing and adding them, perhaps follow their example.