function FieldItemList::generateSampleItems
Same name in other branches
- 9 core/lib/Drupal/Core/Field/FieldItemList.php \Drupal\Core\Field\FieldItemList::generateSampleItems()
- 10 core/lib/Drupal/Core/Field/FieldItemList.php \Drupal\Core\Field\FieldItemList::generateSampleItems()
- 11.x core/lib/Drupal/Core/Field/FieldItemList.php \Drupal\Core\Field\FieldItemList::generateSampleItems()
Overrides FieldItemListInterface::generateSampleItems
File
-
core/
lib/ Drupal/ Core/ Field/ FieldItemList.php, line 249
Class
- FieldItemList
- Represents an entity field; that is, a list of field item objects.
Namespace
Drupal\Core\FieldCode
public function generateSampleItems($count = 1) {
$field_definition = $this->getFieldDefinition();
$field_type_class = $field_definition->getItemDefinition()
->getClass();
for ($delta = 0; $delta < $count; $delta++) {
$values[$delta] = $field_type_class::generateSampleValue($field_definition);
}
$this->setValue($values);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.