You are here

class RouteSubscriber in Varbase Total Control Dashboard 8

Same name and namespace in other branches
  1. 8.6 src/Routing/RouteSubscriber.php \Drupal\varbase_total_control\Routing\RouteSubscriber
  2. 8.5 src/Routing/RouteSubscriber.php \Drupal\varbase_total_control\Routing\RouteSubscriber
  3. 9.0.x src/Routing/RouteSubscriber.php \Drupal\varbase_total_control\Routing\RouteSubscriber

Listens to the dynamic route events.

Hierarchy

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

Expanded class hierarchy of RouteSubscriber

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

File

src/Routing/RouteSubscriber.php, line 12

Namespace

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

  /**
   * {@inheritdoc}
   */
  protected function alterRoutes(RouteCollection $collection) {
    if ($route = $collection
      ->get('page_manager.page_view_total_control_dashboard_total_control_dashboard-panels_variant-0')) {
      $route
        ->setRequirement('_permission', 'have total control');
    }
    if ($route = $collection
      ->get('page_manager.page_view_total_control_dashboard_total_control_dashboard-panels_variant-1')) {
      $route
        ->setRequirement('_permission', 'have total control');
    }
  }

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {

    // Run after PageManagerRoutesAlterSubscriber.
    $events[RoutingEvents::ALTER][] = [
      'onAlterRoutes',
      -170,
    ];
    return $events;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
RouteSubscriber::alterRoutes protected function Alters existing routes for a specific collection. Overrides RouteSubscriberBase::alterRoutes
RouteSubscriber::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to. Overrides RouteSubscriberBase::getSubscribedEvents
RouteSubscriberBase::onAlterRoutes public function Delegates the route altering to self::alterRoutes(). 1