public function LoadHelper::importDirectory in YAML Content 8
Import specified yaml content file(s).
Parameters
string $directory: The directory path containing the yaml content file(s) to be imported.
string $file: (Optional) The name of a file (without the trailing `.content.yml` to be imported or an array of files to import. If this argument is not provided then all files in the directory matching `*.content.yml` are queued for import.
File
- src/
Service/ LoadHelper.php, line 59
Class
- LoadHelper
- A helper class to support the content loading process.
Namespace
Drupal\yaml_content\ServiceCode
public function importDirectory($directory, $file = NULL) {
$this->loader
->setContentPath($directory);
// Identify files for import.
$mask = '/' . (isset($file) ? $file : '.*') . '\\.content\\.yml/';
$files = $this
->discoverFiles($directory . '/content', $mask);
$this
->importFiles($files);
}