class TfaRouteSubscriber in Two-factor Authentication (TFA) 8
Listens to the dynamic route events.
Class TfaRouteSubscriber.
@package Drupal\tfa\Routing
Hierarchy
- class \Drupal\Core\Routing\RouteSubscriberBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
- class \Drupal\tfa\Routing\TfaRouteSubscriber
Expanded class hierarchy of TfaRouteSubscriber
1 string reference to 'TfaRouteSubscriber'
1 service uses TfaRouteSubscriber
File
- src/
Routing/ TfaRouteSubscriber.php, line 15
Namespace
Drupal\tfa\RoutingView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RouteSubscriberBase:: |
public static | function | Returns an array of event names this subscriber wants to listen to. | 5 |
RouteSubscriberBase:: |
public | function | Delegates the route altering to self::alterRoutes(). | 1 |
TfaRouteSubscriber:: |
public | function |
Overrides user.login route with our custom login form. Overrides RouteSubscriberBase:: |