public function UrlGenerator::__construct

public UrlGenerator::__construct(RouteProviderInterface $provider, OutboundPathProcessorInterface $path_processor, OutboundRouteProcessorInterface $route_processor, RequestStack $request_stack, array $filter_protocols = ['http', 'https'])

Constructs a new generator object.

Parameters

\Drupal\Core\Routing\RouteProviderInterface $provider: The route provider to be searched for routes.

\Drupal\Core\PathProcessor\OutboundPathProcessorInterface $path_processor: The path processor to convert the system path to one suitable for urls.

\Drupal\Core\RouteProcessor\OutboundRouteProcessorInterface $route_processor: The route processor.

\Symfony\Component\HttpFoundation\RequestStack $request_stack: A request stack object.

string[] $filter_protocols: (optional) An array of protocols allowed for URL generation.

File

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

Class

UrlGenerator
Generates URLs from route names and parameters.

Namespace

Drupal\Core\Routing

Code

public function __construct(RouteProviderInterface $provider, OutboundPathProcessorInterface $path_processor, OutboundRouteProcessorInterface $route_processor, RequestStack $request_stack, array $filter_protocols = ['http', 'https']) {
  $this->provider = $provider;
  $this->context = new RequestContext();

  $this->pathProcessor = $path_processor;
  $this->routeProcessor = $route_processor;
  UrlHelper::setAllowedProtocols($filter_protocols);
  $this->requestStack = $request_stack;
}

© 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!UrlGenerator.php/function/UrlGenerator::__construct/8.1.x