UrlGeneratorTrait deprecated
trait UrlGeneratorTrait (View source)
deprecated
Wrapper methods for the Url Generator.
This utility trait should only be used in application-level code, such as classes that would implement ContainerInjectionInterface. Services registered in the Container should not use this trait but inject the appropriate service directly for easier testing.
Properties
| protected UrlGeneratorInterface | $urlGenerator | The url generator. |
Methods
Generates a URL or path for a specific route based on the given parameters.
Returns a redirect response object for the specified route.
Details
protected string
url($route_name, $route_parameters = [], $options = [])
deprecated
deprecated
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().
protected RedirectResponse
redirect(string $route_name, array $route_parameters = [], array $options = [], int $status = 302)
deprecated
deprecated
Returns a redirect response object for the specified route.
protected UrlGeneratorInterface
getUrlGenerator()
deprecated
deprecated
Returns the URL generator service.
$this
setUrlGenerator(UrlGeneratorInterface $generator)
deprecated
deprecated
Sets the URL generator service.