You are here

public function RequestPath::__construct in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/system/src/Plugin/Condition/RequestPath.php \Drupal\system\Plugin\Condition\RequestPath::__construct()

Constructs a RequestPath condition plugin.

Parameters

\Drupal\path_alias\AliasManagerInterface $alias_manager: An alias manager to find the alias for the current system path.

\Drupal\Core\Path\PathMatcherInterface $path_matcher: The path matcher service.

\Symfony\Component\HttpFoundation\RequestStack $request_stack: The request stack.

\Drupal\Core\Path\CurrentPathStack $current_path: The current path.

array $configuration: A configuration array containing information about the plugin instance.

string $plugin_id: The plugin_id for the plugin instance.

array $plugin_definition: The plugin implementation definition.

Overrides ConditionPluginBase::__construct

File

core/modules/system/src/Plugin/Condition/RequestPath.php, line 71

Class

RequestPath
Provides a 'Request Path' condition.

Namespace

Drupal\system\Plugin\Condition

Code

public function __construct($alias_manager, PathMatcherInterface $path_matcher, RequestStack $request_stack, CurrentPathStack $current_path, array $configuration, $plugin_id, array $plugin_definition) {
  parent::__construct($configuration, $plugin_id, $plugin_definition);
  if (!$alias_manager instanceof AliasManagerInterface) {
    @trigger_error('Calling \\' . __METHOD__ . ' with \\' . CoreAliasManagerInterface::class . ' instead of \\' . AliasManagerInterface::class . ' is deprecated in drupal:8.8.0. The new service will be required in drupal:9.0.0. See https://www.drupal.org/node/3092086', E_USER_DEPRECATED);
    $alias_manager = \Drupal::service('path_alias.manager');
  }
  $this->aliasManager = $alias_manager;
  $this->pathMatcher = $path_matcher;
  $this->requestStack = $request_stack;
  $this->currentPath = $current_path;
}