You are here

protected function RouteSubscriber::alterRoutes in Panopoly 8.2

Same name in this branch
  1. 8.2 modules/panopoly/panopoly_magic/src/Routing/RouteSubscriber.php \Drupal\panopoly_magic\Routing\RouteSubscriber::alterRoutes()
  2. 8.2 modules/panopoly/panopoly_media/src/Routing/RouteSubscriber.php \Drupal\panopoly_media\Routing\RouteSubscriber::alterRoutes()

Alters existing routes for a specific collection.

Parameters

\Symfony\Component\Routing\RouteCollection $collection: The route collection for adding routes.

Overrides RouteSubscriberBase::alterRoutes

File

modules/panopoly/panopoly_media/src/Routing/RouteSubscriber.php, line 16

Class

RouteSubscriber
Implements a route subscriber for Panopoly Media.

Namespace

Drupal\panopoly_media\Routing

Code

protected function alterRoutes(RouteCollection $collection) {

  // Remove the title from our entity browsers.
  $entity_browser_ids = [
    'panopoly_media_field_media_browser',
    'panopoly_media_wysiwyg_media_browser',
  ];
  foreach ($entity_browser_ids as $entity_browser_id) {
    if ($route = $collection
      ->get("entity_browser.{$entity_browser_id}")) {
      $defaults = $route
        ->getDefaults();
      unset($defaults['_title_callback']);
      $route
        ->setDefaults($defaults);
    }
  }
}