public function ProcessedContentLoader::recursivelyPreprocessData in YAML Content 8.2
Recursively navigate the content hierarchy to apply processors.
Parameters
mixed $import_data: Array or string data extracted from the loaded content file.
File
- src/
ContentLoader/ ProcessedContentLoader.php, line 218
Class
- ProcessedContentLoader
- A ContentLoader supporting processing of content through plugins.
Namespace
Drupal\yaml_content\ContentLoaderCode
public function recursivelyPreprocessData(&$import_data) {
if (!is_array($import_data)) {
return;
}
foreach ($import_data as $key => &$value) {
// Preprocess each array value recursively.
if (is_array($value)) {
$context = [];
// Preprocess this branch.
$this
->preprocessData($value, $context);
// Recurse further for additional preprocessing.
if (is_array($value)) {
array_walk($value, [
$this,
'recursivelyPreprocessData',
]);
}
}
}
}