class WebformCardsRouteSubscriber in Webform 8.5
Same name and namespace in other branches
- 6.x modules/webform_cards/src/Routing/WebformCardsRouteSubscriber.php \Drupal\webform_cards\Routing\WebformCardsRouteSubscriber
Remove webform cards routes.
Hierarchy
- class \Drupal\Core\Routing\RouteSubscriberBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
- class \Drupal\webform_cards\Routing\WebformCardsRouteSubscriber
Expanded class hierarchy of WebformCardsRouteSubscriber
1 string reference to 'WebformCardsRouteSubscriber'
- webform_cards.services.yml in modules/
webform_cards/ webform_cards.services.yml - modules/webform_cards/webform_cards.services.yml
1 service uses WebformCardsRouteSubscriber
File
- modules/
webform_cards/ src/ Routing/ WebformCardsRouteSubscriber.php, line 12
Namespace
Drupal\webform_cards\RoutingView source
class WebformCardsRouteSubscriber extends RouteSubscriberBase {
/**
* The module handler.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
protected $moduleHandler;
/**
* Constructs a WebformCardsRouteSubscriber object.
*
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler.
*/
public function __construct(ModuleHandlerInterface $module_handler) {
$this->moduleHandler = $module_handler;
}
/**
* {@inheritdoc}
*/
protected function alterRoutes(RouteCollection $collection) {
if (!$this->moduleHandler
->moduleExists('webform_ui')) {
$collection
->remove('entity.webform_ui.element.add_card');
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
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 |
WebformCardsRouteSubscriber:: |
protected | property | The module handler. | |
WebformCardsRouteSubscriber:: |
protected | function |
Alters existing routes for a specific collection. Overrides RouteSubscriberBase:: |
|
WebformCardsRouteSubscriber:: |
public | function | Constructs a WebformCardsRouteSubscriber object. |