You are here

public function YamlDirectoryDiscovery::__construct in Drupal 10

Same name in this branch
  1. 10 core/lib/Drupal/Component/Discovery/YamlDirectoryDiscovery.php \Drupal\Component\Discovery\YamlDirectoryDiscovery::__construct()
  2. 10 core/lib/Drupal/Core/Plugin/Discovery/YamlDirectoryDiscovery.php \Drupal\Core\Plugin\Discovery\YamlDirectoryDiscovery::__construct()
Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Plugin/Discovery/YamlDirectoryDiscovery.php \Drupal\Core\Plugin\Discovery\YamlDirectoryDiscovery::__construct()
  2. 9 core/lib/Drupal/Core/Plugin/Discovery/YamlDirectoryDiscovery.php \Drupal\Core\Plugin\Discovery\YamlDirectoryDiscovery::__construct()

Constructs a YamlDirectoryDiscovery object.

Parameters

array $directories: An array of directories to scan, keyed by the provider. The value can either be a string or an array of strings. The string values should be the path of a directory to scan.

string $file_cache_key_suffix: The file cache key suffix. This should be unique for each type of discovery.

string $key: (optional) The key contained in the discovered data that identifies it. Defaults to 'id'.

Overrides YamlDiscovery::__construct

File

core/lib/Drupal/Core/Plugin/Discovery/YamlDirectoryDiscovery.php, line 26

Class

YamlDirectoryDiscovery
Allows multiple YAML files per directory to define plugin definitions.

Namespace

Drupal\Core\Plugin\Discovery

Code

public function __construct(array $directories, $file_cache_key_suffix, $key = 'id') {

  // Intentionally does not call parent constructor as this class uses a
  // different YAML discovery.
  $this->discovery = new ComponentYamlDirectoryDiscovery($directories, $file_cache_key_suffix, $key);
}