public function UrlGenerator::__construct

Same name in this branch
  1. 8.x drupal/core/lib/Drupal/Core/Routing/UrlGenerator.php \Drupal\Core\Routing\UrlGenerator::__construct()
  2. 8.x drupal/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/UrlGenerator.php \Symfony\Component\Routing\Generator\UrlGenerator::__construct()

Constructs a new generator object.

Parameters

\Symfony\Cmf\Component\Routing\RouteProviderInterface $provider: The route provider to be searched for routes.

\Drupal\Core\Path\AliasManagerInterface $alias_manager: The alias manager responsible for path aliasing.

\Symfony\Component\HttpKernel\Log\LoggerInterface $logger: An optional logger for recording errors.

Overrides ProviderBasedGenerator::__construct

1 method overrides UrlGenerator::__construct()
NullGenerator::__construct in drupal/core/lib/Drupal/Core/Routing/NullGenerator.php
Override the parent constructor.

File

drupal/core/lib/Drupal/Core/Routing/UrlGenerator.php, line 81
Contains Drupal\Core\Routing\UrlGenerator.

Class

UrlGenerator
A Generator creates URL strings based on a specified route.

Namespace

Drupal\Core\Routing

Code

public function __construct(RouteProviderInterface $provider, OutboundPathProcessorInterface $path_processor, ConfigFactory $config, Settings $settings, LoggerInterface $logger = NULL) {
  parent::__construct($provider, $logger);
  $this->pathProcessor = $path_processor;
  $this->mixedModeSessions = $settings
    ->get('mixed_mode_sessions', FALSE);
  $allowed_protocols = $config
    ->get('system.filter')
    ->get('protocols') ?: array(
    'http',
    'https',
  );
  UrlValidator::setAllowedProtocols($allowed_protocols);
}