You are here

class TfaRouteSubscriber in Two-factor Authentication (TFA) 8

Listens to the dynamic route events.

Class TfaRouteSubscriber.

@package Drupal\tfa\Routing

Hierarchy

Expanded class hierarchy of TfaRouteSubscriber

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

File

src/Routing/TfaRouteSubscriber.php, line 15

Namespace

Drupal\tfa\Routing
View source
class TfaRouteSubscriber extends RouteSubscriberBase {

  /**
   * Overrides user.login route with our custom login form.
   *
   * @param \Symfony\Component\Routing\RouteCollection $collection
   *   Route to be altered.
   */
  public function alterRoutes(RouteCollection $collection) {

    // Change path of user login to our overridden TFA login form.
    if ($route = $collection
      ->get('user.login')) {
      $route
        ->setDefault('_form', '\\Drupal\\tfa\\Form\\TfaLoginForm');
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
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
TfaRouteSubscriber::alterRoutes public function Overrides user.login route with our custom login form. Overrides RouteSubscriberBase::alterRoutes