You are here

class RouteSubscriber in Webform Views Integration 8.5

Alter the routes in order to allow multiple views on the same route.

Alter the routes so '{webform}' parameter is present and defaults to the corresponding webform for all views that are related to webform submissions.


Expanded class hierarchy of RouteSubscriber

1 string reference to 'RouteSubscriber' in ./
1 service uses RouteSubscriber
webform_views.route_subscriber in ./


src/Routing/RouteSubscriber.php, line 16


View source
class RouteSubscriber extends RouteSubscriberBase {

   * @var StateInterface
  protected $state;

   * @var EntityTypeManagerInterface
  protected $entityTypeManager;

   * RouteSubscriber constructor.
  public function __construct(StateInterface $state, EntityTypeManagerInterface $entity_type_manager) {
    $this->state = $state;
    $this->entityTypeManager = $entity_type_manager;

   * {@inheritdoc}
  protected function alterRoutes(RouteCollection $collection) {
    $view_route_names = $this->state
    foreach (webform_views_applicable_views() as $trio) {
      list($view_id, $display_id, $path) = $trio;
      $route_name = $view_route_names[$view_id . '.' . $display_id];
      if (($route = $collection
        ->get($route_name)) && ($webform_id = webform_views_webform_id_from_path($path))) {
          ->getPath() . '/{webform}');
          ->setDefault('webform', $webform_id);
        $options = $route
        $options['parameters']['webform']['type'] = 'entity:webform';



Namesort descending Modifiers Type Description Overrides
RouteSubscriber::$entityTypeManager protected property
RouteSubscriber::$state protected property
RouteSubscriber::alterRoutes protected function Alters existing routes for a specific collection. Overrides RouteSubscriberBase::alterRoutes
RouteSubscriber::__construct public function RouteSubscriber constructor.
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