You are here

protected function SampleDataProcessor::loadSampleDataSet in YAML Content 8.2

Load sample data set.

The following keys are searched for within the $config array:

  • module The module containing the data file to be loaded.
  • path The path within the module to look for the data file. Defaults to `content/data`.
  • file The name of the data file such that the file name is `<file>.data.yml`.

Parameters

array $config: Configuration for the sample data set to be loaded.

Return value

\Drupal\sample_data\SampleDataSet A sample data set to fetch sample data from.

1 call to SampleDataProcessor::loadSampleDataSet()
SampleDataProcessor::preprocess in modules/sample_data/src/Plugin/YamlContent/SampleDataProcessor.php
Pre-process import data and manipulate it prior to content creation.

File

modules/sample_data/src/Plugin/YamlContent/SampleDataProcessor.php, line 71

Class

SampleDataProcessor
Import processor to support entity queries and references.

Namespace

Drupal\sample_data\Plugin\YamlContent

Code

protected function loadSampleDataSet(array $config) {
  $path = drupal_get_path('module', $config['module']);
  $path .= '/' . (isset($config['path']) ? $config['path'] : 'content/data');
  $path .= '/' . $config['file'] . '.data.yml';
  $data = $this->dataLoader
    ->loadDataSet($path);
  return $data;
}