You are here

class RouteSubscriber in Automatic IP ban (Autoban) 8

Route alter.

Hierarchy

Expanded class hierarchy of RouteSubscriber

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

File

modules/autoban_dblog/src/Routing/RouteSubscriber.php, line 17
Contains \Drupal\autoban_dblog\Routing\RouteSubscriber.

Namespace

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

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    $events[RoutingEvents::ALTER] = [
      'onAlterRoutes',
      -176,
    ];
    return $events;
  }

  /**
   * {@inheritdoc}
   */
  public function alterRoutes(RouteCollection $collection) {

    // Change controller for '/admin/reports/dblog'.
    if ($route = $collection
      ->get('dblog.overview')) {
      $route
        ->setDefault('_controller', '\\Drupal\\autoban_dblog\\Controller\\AutobanDbLogController::overview');
    }
  }

}

Members

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