W3cubDocs

/Drupal 8

public function ControllerResolver::getController

public ControllerResolver::getController(Request $request)

This method looks for a '_controller' request attribute that represents the controller name (a string like ClassName::MethodName).

Overrides ControllerResolver::getController

File

core/lib/Drupal/Core/Controller/ControllerResolver.php, line 87

Class

ControllerResolver
ControllerResolver to enhance controllers beyond Symfony's basic handling.

Namespace

Drupal\Core\Controller

Code

public function getController(Request $request) {
  if (!$controller = $request->attributes->get('_controller')) {
    return FALSE;
  }
  return $this->getControllerFromDefinition($controller, $request->getPathInfo());
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Controller!ControllerResolver.php/function/ControllerResolver::getController/8.1.x