You are here

public function AliasWhitelist::__construct in Drupal 8

Constructs an AliasWhitelist object.

Parameters

string $cid: The cache id to use.

\Drupal\Core\Cache\CacheBackendInterface $cache: The cache backend.

\Drupal\Core\Lock\LockBackendInterface $lock: The lock backend.

\Drupal\Core\State\StateInterface $state: The state keyvalue store.

\Drupal\Core\Path\AliasRepositoryInterface $alias_repository: The path alias repository.

Overrides CacheCollector::__construct

File

core/lib/Drupal/Core/Path/AliasWhitelist.php, line 56

Class

AliasWhitelist
Extends CacheCollector to build the path alias whitelist over time.

Namespace

Drupal\Core\Path

Code

public function __construct($cid, CacheBackendInterface $cache, LockBackendInterface $lock, StateInterface $state, $alias_repository) {
  parent::__construct($cid, $cache, $lock);
  $this->state = $state;
  if (!$alias_repository instanceof AliasRepositoryInterface) {
    @trigger_error('Passing the path.alias_storage service to AliasWhitelist::__construct() is deprecated in drupal:8.8.0 and will be removed before drupal:9.0.0. Pass the new dependencies instead. See https://www.drupal.org/node/3013865.', E_USER_DEPRECATED);
    $alias_repository = \Drupal::service('path_alias.repository');
  }
  $this->pathAliasRepository = $alias_repository;

  // This is used as base class by the new class, so we do not trigger
  // deprecation notices when that or any child class is instantiated.
  $new_class = 'Drupal\\path_alias\\AliasWhitelist';
  if (!is_a($this, $new_class) && class_exists($new_class)) {
    @trigger_error('The \\' . __CLASS__ . ' class is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Instead, use \\' . $new_class . '. See https://drupal.org/node/3092086', E_USER_DEPRECATED);
  }
}