public function LoadHelper::importModule in YAML Content 8
Import specified yaml content file(s) from a designated module.
Parameters
string $module: The module to look for content files within.
This command assumes files will be contained within a `content/` directory at the top of the module's main directory. Any files within matching the pattern `*.content.yml` will then be imported.
string|string[] $file: (Optional) The name of a file 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 83
Class
- LoadHelper
- A helper class to support the content loading process.
Namespace
Drupal\yaml_content\ServiceCode
public function importModule($module, $file = NULL) {
$path = drupal_get_path('module', $module);
$this->loader
->setContentPath($path);
// Identify files for import.
$mask = '/' . (isset($file) ? $file : '.*') . '\\.content\\.yml/';
$files = $this
->discoverFiles($path . '/content', $mask);
$this
->importFiles($files);
}