You are here

class RouteSubscriber in ImageAPI Optimize WebP 8

Same name and namespace in other branches
  1. 2.x src/Routing/RouteSubscriber.php \Drupal\imageapi_optimize_webp\Routing\RouteSubscriber

Class RouteSubscriber.

Override 'image.style_public' controller to handle .webp deriver.

Hierarchy

  • class \Drupal\Core\Routing\RouteSubscriberBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface

Expanded class hierarchy of RouteSubscriber

1 string reference to 'RouteSubscriber'
imageapi_optimize_webp.services.yml in ./imageapi_optimize_webp.services.yml
imageapi_optimize_webp.services.yml
1 service uses RouteSubscriber
imageapi_optimize_webp.route_subscriber in ./imageapi_optimize_webp.services.yml
Drupal\imageapi_optimize_webp\Routing\RouteSubscriber

File

src/Routing/RouteSubscriber.php, line 13

Namespace

Drupal\imageapi_optimize_webp\Routing
View source
class RouteSubscriber extends RouteSubscriberBase {

  /**
   * {@inheritdoc}
   */
  protected function alterRoutes(RouteCollection $collection) {
    if ($route = $collection
      ->get('image.style_public')) {
      $route
        ->setDefault('_controller', 'Drupal\\imageapi_optimize_webp\\Controller\\ImageStyleDownloadController::deliver');
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
RouteSubscriber::alterRoutes protected function Alters existing routes for a specific collection. Overrides RouteSubscriberBase::alterRoutes
RouteSubscriberBase::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to. 5
RouteSubscriberBase::onAlterRoutes public function Delegates the route altering to self::alterRoutes(). 1