You are here

class WebformSubmissionLogRouteSubscriber in Webform 8.5

Same name and namespace in other branches
  1. 6.x modules/webform_submission_log/src/Routing/WebformSubmissionLogRouteSubscriber.php \Drupal\webform_submission_log\Routing\WebformSubmissionLogRouteSubscriber

Remove webform node log routes.

Hierarchy

Expanded class hierarchy of WebformSubmissionLogRouteSubscriber

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

File

modules/webform_submission_log/src/Routing/WebformSubmissionLogRouteSubscriber.php, line 12

Namespace

Drupal\webform_submission_log\Routing
View source
class WebformSubmissionLogRouteSubscriber extends RouteSubscriberBase {

  /**
   * The module handler.
   *
   * @var \Drupal\Core\Extension\ModuleHandlerInterface
   */
  protected $moduleHandler;

  /**
   * Constructs a WebformSubmissionLogRouteSubscriber 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_node')) {
      $collection
        ->remove('entity.node.webform.results_log');
      $collection
        ->remove('entity.node.webform_submission.log');
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
RouteSubscriberBase::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to. 5
RouteSubscriberBase::onAlterRoutes public function Delegates the route altering to self::alterRoutes(). 1
WebformSubmissionLogRouteSubscriber::$moduleHandler protected property The module handler.
WebformSubmissionLogRouteSubscriber::alterRoutes protected function Alters existing routes for a specific collection. Overrides RouteSubscriberBase::alterRoutes
WebformSubmissionLogRouteSubscriber::__construct public function Constructs a WebformSubmissionLogRouteSubscriber object.