You are here

public static function VotingApiField::generateSampleValue in Votingapi Widgets 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/VotingApiField.php, line 92

Class

VotingApiField
Plugin implementation of the 'voting_api_field' field type.

Namespace

Drupal\votingapi_widgets\Plugin\Field\FieldType

Code

public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
  $random = new Random();
  $values['status'] = $random
    ->word(mt_rand(0, 1));
  return $values;
}