function Drupal::routeMatch

Same name and namespace in other branches
  1. 9 core/lib/Drupal.php \Drupal::routeMatch()
  2. 8.9.x core/lib/Drupal.php \Drupal::routeMatch()
  3. 11.x core/lib/Drupal.php \Drupal::routeMatch()

Retrieves the currently active route match object.

Return value

\Drupal\Core\Routing\RouteMatchInterface The currently active route match object.

4 calls to Drupal::routeMatch()
FormBase::getRouteMatch in core/lib/Drupal/Core/Form/FormBase.php
Gets the route match.
hook_entity_presave in core/lib/Drupal/Core/Entity/entity.api.php
Act on an entity before it is created or updated.
hook_ENTITY_TYPE_presave in core/lib/Drupal/Core/Entity/entity.api.php
Act on a specific type of entity before it is created or updated.
ThemeManager::initTheme in core/lib/Drupal/Core/Theme/ThemeManager.php
Initializes the active theme for a given route match.

File

core/lib/Drupal.php, line 288

Class

Drupal
Static Service Container wrapper.

Code

public static function routeMatch() {
  return static::getContainer()->get('current_route_match');
}

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