Patched to Drupal 8.4.8 level. See https://www.drupal.org/sa-core-2018-004 and patch...
[yaffs-website] / web / core / lib / Drupal / Core / Config / Schema / ConfigSchemaDiscovery.php
1 <?php
2
3 namespace Drupal\Core\Config\Schema;
4
5 use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
6 use Drupal\Component\Plugin\Discovery\DiscoveryTrait;
7 use Drupal\Core\Config\StorageInterface;
8
9 /**
10  * Allows YAML files to define config schema types.
11  */
12 class ConfigSchemaDiscovery implements DiscoveryInterface {
13
14   use DiscoveryTrait;
15
16   /**
17    * A storage instance for reading configuration schema data.
18    *
19    * @var \Drupal\Core\Config\StorageInterface
20    */
21   protected $schemaStorage;
22
23   /**
24    * Constructs a ConfigSchemaDiscovery object.
25    *
26    * @param $schema_storage
27    *   The storage object to use for reading schema data.
28    */
29   public function __construct(StorageInterface $schema_storage) {
30     $this->schemaStorage = $schema_storage;
31   }
32
33   /**
34    * {@inheritdoc}
35    */
36   public function getDefinitions() {
37     $definitions = [];
38     foreach ($this->schemaStorage->readMultiple($this->schemaStorage->listAll()) as $schema) {
39       foreach ($schema as $type => $definition) {
40         $definitions[$type] = $definition;
41       }
42     }
43     return $definitions;
44   }
45
46 }