You are here

public static function CpfItem::generateSampleValue in CPF 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldType/CpfItem.php \Drupal\cpf\Plugin\Field\FieldType\CpfItem::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 FieldItemBase::generateSampleValue

File

src/Plugin/Field/FieldType/CpfItem.php, line 144

Class

CpfItem
Plugin implementation of the 'cpf' field type.

Namespace

Drupal\cpf\Plugin\Field\FieldType

Code

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