class PanopolySearchRouteSubscriber in Panopoly Search 8.2
Removes module dependency from /admin/reports/search.
Hierarchy
- class \Drupal\Core\Routing\RouteSubscriberBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
- class \Drupal\panopoly_search\Routing\PanopolySearchRouteSubscriber
Expanded class hierarchy of PanopolySearchRouteSubscriber
1 string reference to 'PanopolySearchRouteSubscriber'
1 service uses PanopolySearchRouteSubscriber
File
- src/
Routing/ PanopolySearchRouteSubscriber.php, line 12
Namespace
Drupal\panopoly_search\RoutingView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PanopolySearchRouteSubscriber:: |
protected | function |
Alters existing routes for a specific collection. Overrides RouteSubscriberBase:: |
|
PanopolySearchRouteSubscriber:: |
public static | function |
Returns an array of event names this subscriber wants to listen to. Overrides RouteSubscriberBase:: |
|
RouteSubscriberBase:: |
public | function | Delegates the route altering to self::alterRoutes(). | 1 |