You are here

public function Config::importDirectory in Helper 8

Import a directory containing configuration files.

Parameters

string $directory: The path to the directory.

array $options: An array of options to pass to file_scan_directory().

Throws

\RuntimeException If unable to decode YAML from file.

\Drupal\Core\Entity\EntityStorageException In unable to save the config.

1 call to Config::importDirectory()
Config::importModule in src/Config.php
Import a module's directory containing configuration files.

File

src/Config.php, line 125

Class

Config
Provides helper for working with configuration.

Namespace

Drupal\helper

Code

public function importDirectory($directory, array $options = []) {
  $files = $this->fileSystem
    ->scanDirectory($directory, '/^.*\\.yml$/', $options);
  foreach ($files as $file) {
    $this
      ->importFile($file->uri);
  }
}