You are here

class RouteSubscriber in RedHen CRM 8

Same name in this branch
  1. 8 src/Routing/RouteSubscriber.php \Drupal\redhen\Routing\RouteSubscriber
  2. 8 modules/redhen_connection/src/Routing/RouteSubscriber.php \Drupal\redhen_connection\Routing\RouteSubscriber

Set Admin Route options.

@package Drupal\redhen\Routing

Hierarchy

Expanded class hierarchy of RouteSubscriber

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

File

src/Routing/RouteSubscriber.php, line 13

Namespace

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

  /**
   * {@inheritdoc}
   */
  protected function alterRoutes(RouteCollection $collection) {
    if (\Drupal::config('redhen.settings')
      ->get('redhen_admin_path')) {
      $redhen_routes = [
        'redhen.dashboard',
        'entity.redhen_contact.canonical',
        'entity.redhen_connection.canonical',
        'entity.redhen_org.canonical',
      ];
      foreach ($redhen_routes as $routename) {
        $route = $collection
          ->get($routename);
        if ($route) {
          $route
            ->setOption('_admin_route', TRUE);
        }
      }
    }
  }

}

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