You are here

class RouteSubscriber in Config Entity Revisions 8.2

Same name in this branch
  1. 8.2 modules/contact_form_revisions/src/Routing/RouteSubscriber.php \Drupal\contact_form_revisions\Routing\RouteSubscriber
  2. 8.2 modules/webform_revisions/src/Routing/RouteSubscriber.php \Drupal\webform_revisions\Routing\RouteSubscriber
  3. 8.2 modules/view_revisions/src/Routing/RouteSubscriber.php \Drupal\view_revisions\Routing\RouteSubscriber

Class RouteSubscriber.

@package Drupal\contact_form_revisions\Routing

Hierarchy

  • class \Drupal\Core\Routing\RouteSubscriberBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface

Expanded class hierarchy of RouteSubscriber

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

File

modules/contact_form_revisions/src/Routing/RouteSubscriber.php, line 13

Namespace

Drupal\contact_form_revisions\Routing
View source
class RouteSubscriber extends RouteSubscriberBase {

  /**
   * {@inheritdoc}
   */
  protected function alterRoutes(RouteCollection $collection) {
    $latest_revision_routes = [
      'entity.contact_form.edit_form',
    ];
    foreach ($latest_revision_routes as $route_name) {
      if ($route = $collection
        ->get($route_name)) {
        $current = $route
          ->getOption('parameters') ?: [];
        $current['contact']['load_latest_revision'] = TRUE;
        $route
          ->setOption('parameters', $current);
      }
    }
  }

}

Members

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