You are here

public function S3fsImageStyleRoutes::routes in S3 File System 8.3

Same name and namespace in other branches
  1. 4.0.x src/Routing/S3fsImageStyleRoutes.php \Drupal\s3fs\Routing\S3fsImageStyleRoutes::routes()

Returns an array of route objects.

Return value

\Symfony\Component\Routing\Route[] An array of route objects.

1 string reference to 'S3fsImageStyleRoutes::routes'
s3fs.routing.yml in ./s3fs.routing.yml
s3fs.routing.yml

File

src/Routing/S3fsImageStyleRoutes.php, line 47

Class

S3fsImageStyleRoutes
Defines a route subscriber to register a url for serving image styles.

Namespace

Drupal\s3fs\Routing

Code

public function routes() {
  $routes = [];

  // Only add route for image styles if image module is enabled.
  if ($this->moduleHandler
    ->moduleExists('image')) {
    $routes['s3fs.image_styles'] = new Route('/s3/files/styles/{image_style}/{scheme}', [
      '_controller' => 'Drupal\\s3fs\\Controller\\S3fsImageStyleDownloadController::deliver',
    ], [
      '_access' => 'TRUE',
    ]);

    // @see \Drupal\redirect\Routing\RouteSubscriber::alterRoutes()
    if ($this->moduleHandler
      ->moduleExists('redirect')) {
      $routes['s3fs.image_styles']
        ->setDefault('_disable_route_normalizer', TRUE);
    }
  }
  return $routes;
}