class RouteSubscriber in Batch add terms 8
Class for route alter.
@package Drupal\batch_add_terms\Routing
Hierarchy
- class \Drupal\Core\Routing\RouteSubscriberBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
- class \Drupal\batch_add_terms\Routing\RouteSubscriber
Expanded class hierarchy of RouteSubscriber
1 string reference to 'RouteSubscriber'
1 service uses RouteSubscriber
File
- src/
Routing/ RouteSubscriber.php, line 13
Namespace
Drupal\batch_add_terms\RoutingView source
class RouteSubscriber extends RouteSubscriberBase {
/**
* {@inheritdoc}
*/
public function alterRoutes(RouteCollection $collection) {
// Altering the access permissions as per vppr or taxonomy_access_fix.
$moduleHandler = \Drupal::service('module_handler');
// If vppr module enabled.
if ($moduleHandler
->moduleExists('vppr')) {
if ($route = $collection
->get('batch_add_terms.mass_add')) {
$route
->setRequirements([
'_custom_access' => '\\vppr_route_access',
]);
}
$route
->setOption('op', '');
}
// If taxonomy_access_fix module enabled.
if ($moduleHandler
->moduleExists('taxonomy_access_fix')) {
if ($route = $collection
->get('batch_add_terms.mass_add')) {
$route
->setRequirements([
'_custom_access' => '\\taxonomy_access_fix_route_access',
]);
$route
->setOption('op', 'add terms');
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RouteSubscriber:: |
public | function |
Alters existing routes for a specific collection. Overrides RouteSubscriberBase:: |
|
RouteSubscriberBase:: |
public static | function | Returns an array of event names this subscriber wants to listen to. | 5 |
RouteSubscriberBase:: |
public | function | Delegates the route altering to self::alterRoutes(). | 1 |