public static function TwitterEmbedItem::generateSampleValue in Twitter Embed 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/ TwitterEmbedItem.php, line 78
Class
- TwitterEmbedItem
- Plugin implementation of the 'twitter_embed_field' field type.
Namespace
Drupal\twitter_embed\Plugin\Field\FieldTypeCode
public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
// @todo set a list of random accounts
$random = new Random();
$values['value'] = $random
->word(mt_rand(1, TwitterWidgetInterface::USERNAME_MAX_LENGTH));
return $values;
}