You are here

public static function CpfItem::generateSampleValue in CPF 8.2

Same name and namespace in other branches
  1. 8 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 164
Contains \Drupal\cpf\Plugin\Field\FieldType\CpfItem.

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;
}