You are here

class PanopolySearchRouteSubscriber in Panopoly Search 8.2

Removes module dependency from /admin/reports/search.

Hierarchy

Expanded class hierarchy of PanopolySearchRouteSubscriber

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

File

src/Routing/PanopolySearchRouteSubscriber.php, line 12

Namespace

Drupal\panopoly_search\Routing
View source
class PanopolySearchRouteSubscriber extends RouteSubscriberBase {

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {

    // We need to run before ModuleRouteSubscriber.
    $events[RoutingEvents::ALTER] = [
      'onAlterRoutes',
      100,
    ];
    return $events;
  }

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

    // Since panopoly_search is enabled, we want dblog.search to work, so
    // remove the existing module dependency.
    if ($route = $collection
      ->get('dblog.search')) {
      $requirements = $route
        ->getRequirements();
      unset($requirements['_module_dependencies']);
      $route
        ->setRequirements($requirements);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PanopolySearchRouteSubscriber::alterRoutes protected function Alters existing routes for a specific collection. Overrides RouteSubscriberBase::alterRoutes
PanopolySearchRouteSubscriber::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