You are here

class RouteSubscriber in Total Control Admin Dashboard 8.2

Same name and namespace in other branches
  1. 3.0.x src/Routing/RouteSubscriber.php \Drupal\total_control\Routing\RouteSubscriber

Listens to the dynamic route events.

Hierarchy

Expanded class hierarchy of RouteSubscriber

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

File

src/Routing/RouteSubscriber.php, line 12

Namespace

Drupal\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-http_status_code-0')) {
      $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