You are here

public function SampleDataLoader::loadDataSet in YAML Content 8.2

Load a data set from a given file.

Parameters

string $file: The fully qualified filename and path to be loaded.

Return value

\Drupal\sample_data\SampleDataSet A loaded sample data set.

File

modules/sample_data/src/SampleDataLoader.php, line 51

Class

SampleDataLoader
Provides methods for retrieving sample data to be used in demo content.

Namespace

Drupal\sample_data

Code

public function loadDataSet($file) {
  if (!isset($this->data[$file])) {
    $data = $this->decoder
      ->decode(file_get_contents($file));
    $this->data[$file] = new SampleDataSet($data);
  }
  return $this->data[$file];
}