protected function RouteSubscriber::alterRoutes in ImageAPI Optimize WebP 2.x
Same name and namespace in other branches
- 8 src/Routing/RouteSubscriber.php \Drupal\imageapi_optimize_webp\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
- src/
Routing/ RouteSubscriber.php, line 18
Class
- RouteSubscriber
- Class RouteSubscriber.
Namespace
Drupal\imageapi_optimize_webp\RoutingCode
protected function alterRoutes(RouteCollection $collection) {
if ($route = $collection
->get('image.style_public')) {
$route
->setDefault('_controller', 'Drupal\\imageapi_optimize_webp\\Controller\\ImageStyleDownloadController::deliver');
}
if ($route = $collection
->get('image.style_private')) {
$route
->setDefault('_controller', 'Drupal\\imageapi_optimize_webp\\Controller\\ImageStyleDownloadController::deliver');
}
}