You are here

public static function UuidItem::generateSampleValue in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Field/Plugin/Field/FieldType/UuidItem.php \Drupal\Core\Field\Plugin\Field\FieldType\UuidItem::generateSampleValue()

Generates placeholder field values.

Useful when populating site with placeholder content during site building or profiling.

Parameters

\Drupal\Core\Field\FieldDefinitionInterface $field_definition: The field definition.

Return value

array An associative array of values.

Overrides StringItem::generateSampleValue

File

core/lib/Drupal/Core/Field/Plugin/Field/FieldType/UuidItem.php, line 55

Class

UuidItem
Defines the 'uuid' entity field type.

Namespace

Drupal\Core\Field\Plugin\Field\FieldType

Code

public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
  $values['value'] = \Drupal::service('uuid')
    ->generate();
  return $values;
}