function UrlGenerator::supports

Same name in other branches
  1. 9 core/lib/Drupal/Core/Routing/UrlGenerator.php \Drupal\Core\Routing\UrlGenerator::supports()
  2. 8.9.x core/lib/Drupal/Core/Routing/UrlGenerator.php \Drupal\Core\Routing\UrlGenerator::supports()

Checks if route name is a string or route object.

Parameters

string|\Symfony\Component\Routing\Route $name: The route "name" which may also be an object or anything.

Return value

bool TRUE if the passed in value a valid route, FALSE otherwise.

Deprecated

in drupal:10.1.0 and is removed from drupal:11.0.0. Only string route names are supported.

See also

https://www.drupal.org/node/3172303

File

core/lib/Drupal/Core/Routing/UrlGenerator.php, line 487

Class

UrlGenerator
Generates URLs from route names and parameters.

Namespace

Drupal\Core\Routing

Code

public function supports($name) {
    @trigger_error(__METHOD__ . '() is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Only string route names are supported. See https://www.drupal.org/node/3172303', E_USER_DEPRECATED);
    // Support a route object and any string as route name.
    return is_string($name) || $name instanceof SymfonyRoute;
}

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