You are here

protected function UrlGeneratorTrait::url in Drupal 8

Generates a URL or path for a specific route based on the given parameters.

For details on the arguments, usage, and possible exceptions see \Drupal\Core\Routing\UrlGeneratorInterface::generateFromRoute().

Return value

string The generated URL for the given route.

Deprecated

in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Url::fromUri() instead.

See also

\Drupal\Core\Routing\UrlGeneratorInterface::generateFromRoute()

File

core/lib/Drupal/Core/Routing/UrlGeneratorTrait.php, line 41

Class

UrlGeneratorTrait
Wrapper methods for the Url Generator.

Namespace

Drupal\Core\Routing

Code

protected function url($route_name, $route_parameters = [], $options = []) {
  @trigger_error(__NAMESPACE__ . "\\UrlGeneratorTrait::url() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \\Drupal\\Core\\Url::fromUri() instead. See https://www.drupal.org/node/2614344", E_USER_DEPRECATED);
  return $this
    ->getUrlGenerator()
    ->generateFromRoute($route_name, $route_parameters, $options);
}