You are here

public static function BigIntItem::generateSampleValue in Big Integer 8

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 FieldItemBase::generateSampleValue

File

src/Plugin/Field/FieldType/BigIntItem.php, line 89

Class

BigIntItem
Defines the 'bigint' field type.

Namespace

Drupal\bigint\Plugin\Field\FieldType

Code

public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
  $min = $field_definition
    ->getSetting('min') ?: 0;
  $max = $field_definition
    ->getSetting('max') ?: 999;
  $values['value'] = mt_rand($min, $max);
  return $values;
}