trait UrlGeneratorTrait

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.

Hierarchy

Deprecated

in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal\Core\Url instead.

File

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

Namespace

Drupal\Core\Routing

Members

Name Modifiers Type Description
UrlGeneratorTrait::$urlGenerator protected property The url generator.
UrlGeneratorTrait::getUrlGenerator protected function Returns the URL generator service.
UrlGeneratorTrait::redirect protected function Returns a redirect response object for the specified route.
UrlGeneratorTrait::setUrlGenerator public function Sets the URL generator service.
UrlGeneratorTrait::url Deprecated protected function Generates a URL or path for a specific route based on the given parameters.

© 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!Routing!UrlGeneratorTrait.php/trait/UrlGeneratorTrait/8.1.x