YamlDirectoryDiscovery.php

Same filename in this branch
  1. 11.x core/lib/Drupal/Component/Discovery/YamlDirectoryDiscovery.php
Same filename in other branches
  1. 9 core/lib/Drupal/Core/Plugin/Discovery/YamlDirectoryDiscovery.php
  2. 9 core/lib/Drupal/Component/Discovery/YamlDirectoryDiscovery.php
  3. 8.9.x core/lib/Drupal/Core/Plugin/Discovery/YamlDirectoryDiscovery.php
  4. 8.9.x core/lib/Drupal/Component/Discovery/YamlDirectoryDiscovery.php
  5. 10 core/lib/Drupal/Core/Plugin/Discovery/YamlDirectoryDiscovery.php
  6. 10 core/lib/Drupal/Component/Discovery/YamlDirectoryDiscovery.php

Namespace

Drupal\Core\Plugin\Discovery

File

core/lib/Drupal/Core/Plugin/Discovery/YamlDirectoryDiscovery.php

View source
<?php

namespace Drupal\Core\Plugin\Discovery;

use Drupal\Component\Discovery\YamlDirectoryDiscovery as ComponentYamlDirectoryDiscovery;

/**
 * Allows multiple YAML files per directory to define plugin definitions.
 */
class YamlDirectoryDiscovery extends YamlDiscovery {
    
    /**
     * Constructs a YamlDirectoryDiscovery object.
     *
     * @param 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.
     * @param string $file_cache_key_suffix
     *   The file cache key suffix. This should be unique for each type of
     *   discovery.
     * @param string $key
     *   (optional) The key contained in the discovered data that identifies it.
     *   Defaults to 'id'.
     */
    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);
    }

}

Classes

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.