You are here

class RouteSubscriber in Simple Password Reset 8

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'
simple_pass_reset.services.yml in ./simple_pass_reset.services.yml
simple_pass_reset.services.yml
1 service uses RouteSubscriber
simple_pass_reset.route_subscriber in ./simple_pass_reset.services.yml
Drupal\simple_pass_reset\Routing\RouteSubscriber

File

src/Routing/RouteSubscriber.php, line 11

Namespace

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

  /**
   * {@inheritdoc}
   */
  protected function alterRoutes(RouteCollection $collection) {

    // Alter user reset password page.
    $route = $collection
      ->get('user.reset');
    if ($route) {
      $route
        ->setDefaults([
        '_title' => 'Choose a new password',
        '_controller' => '\\Drupal\\simple_pass_reset\\Controller\\User::resetPass',
      ]);
      $route
        ->setRequirement('_custom_access', '\\Drupal\\simple_pass_reset\\AccessChecks\\ResetPassAccessCheck::access');
    }
  }

}

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