function ListItemBase::generateSampleValue
Same name in other branches
- 9 core/modules/options/src/Plugin/Field/FieldType/ListItemBase.php \Drupal\options\Plugin\Field\FieldType\ListItemBase::generateSampleValue()
- 10 core/modules/options/src/Plugin/Field/FieldType/ListItemBase.php \Drupal\options\Plugin\Field\FieldType\ListItemBase::generateSampleValue()
- 11.x core/modules/options/src/Plugin/Field/FieldType/ListItemBase.php \Drupal\options\Plugin\Field\FieldType\ListItemBase::generateSampleValue()
Overrides FieldItemBase::generateSampleValue
File
-
core/
modules/ options/ src/ Plugin/ Field/ FieldType/ ListItemBase.php, line 68
Class
- ListItemBase
- Plugin base class inherited by the options field types.
Namespace
Drupal\options\Plugin\Field\FieldTypeCode
public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
$allowed_options = options_allowed_values($field_definition->getFieldStorageDefinition());
$values['value'] = array_rand($allowed_options);
return $values;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.