You are here

protected function PhotosRouteSubscriber::alterRoutes in Album Photos 8.5

Same name and namespace in other branches
  1. 6.0.x src/Routing/PhotosRouteSubscriber.php \Drupal\photos\Routing\PhotosRouteSubscriber::alterRoutes()

Alters existing routes for a specific collection.

Parameters

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

Overrides RouteSubscriberBase::alterRoutes

File

src/Routing/PhotosRouteSubscriber.php, line 34

Class

PhotosRouteSubscriber
Listens to the dynamic route events.

Namespace

Drupal\photos\Routing

Code

protected function alterRoutes(RouteCollection $collection) {
  if ($this->configFactory
    ->get('photos.settings')
    ->get('photos_legacy_view_mode')) {

    // An attempt to preserve image layouts configured pre 8.x-5.x.
    if ($route = $collection
      ->get('entity.photos_image.canonical')) {
      $route
        ->setDefault('_controller', '\\Drupal\\photos\\Controller\\PhotosLegacyImageViewController::view');
    }
  }
}