public function SampleDataSet::get in YAML Content 8.2
Retrieves a sample data for the given type and advances the data counter.
Parameters
string $type: The type of sample data to retrieve.
Return value
string|array|false The sample data or FALSE if it does not exist.
File
- modules/
sample_data/ src/ SampleDataSet.php, line 31
Class
- SampleDataSet
- Provides methods for retrieving sample data to be used in demo content.
Namespace
Drupal\sample_dataCode
public function get($type) {
if (isset($this->data[$type])) {
$sample = current($this->data[$type]);
if (next($this->data[$type]) === FALSE) {
reset($this->data[$type]);
}
return $sample;
}
return FALSE;
}