public function AliasWhitelist::__construct

Constructs an AliasWhitelist object.

Parameters

string $cid: The cache id to use.

string $bin: The cache bin that should be used.

\Drupal\Core\KeyValueStore\KeyValueFactory $keyvalue: The keyvalue factory to get the state cache from.

\Drupal\Core\Database\Connection $connection: The database connection.

Overrides CacheArray::__construct

File

drupal/core/lib/Drupal/Core/Path/AliasWhitelist.php, line 46
Contains \Drupal\Core\Path\AliasWhitelist.

Class

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

Namespace

Drupal\Core\Path

Code

public function __construct($cid, $bin, KeyValueFactory $keyvalue, Connection $connection) {
  parent::__construct($cid, $bin);
  $this->state = $keyvalue
    ->get('state');
  $this->connection = $connection;

  // On a cold start $this->storage will be empty and the whitelist will
  // need to be rebuilt from scratch. The whitelist is initialized from the
  // list of all valid path roots stored in the 'menu_path_roots' state,
  // with values initialized to NULL. During the request, each path requested
  // that matches one of these keys will be looked up and the array value set
  // to either TRUE or FALSE. This ensures that paths which do not exist in
  // the router are not looked up, and that paths that do exist in the router
  // are only looked up once.
  if (empty($this->storage)) {
    $this
      ->loadMenuPathRoots();
  }
}