function AttributeRouteDiscovery::configureRoute

Same name and namespace in other branches
  1. main core/lib/Drupal/Core/Routing/AttributeRouteDiscovery.php \Drupal\Core\Routing\AttributeRouteDiscovery::configureRoute()

Configures the _controller default parameter of a given Route instance.

Parameters

\Symfony\Component\Routing\Route $route: The route to configure.

\ReflectionClass $class: The class.

\ReflectionMethod $method: The method.

1 call to AttributeRouteDiscovery::configureRoute()
AttributeRouteDiscovery::addRoute in core/lib/Drupal/Core/Routing/AttributeRouteDiscovery.php
Adds a route to the provided route collection.

File

core/lib/Drupal/Core/Routing/AttributeRouteDiscovery.php, line 299

Class

AttributeRouteDiscovery
Discovers routes using Symfony's Route attribute.

Namespace

Drupal\Core\Routing

Code

private function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method) : void {
  if ($method->getName() === '__invoke') {
    $route->setDefault('_controller', $class->getName());
  }
  else {
    $route->setDefault('_controller', $class->getName() . '::' . $method->getName());
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.