public static function RevisionItem::generateSampleValue in Multiversion 8
Same name and namespace in other branches
- 8.2 src/Plugin/Field/FieldType/RevisionItem.php \Drupal\multiversion\Plugin\Field\FieldType\RevisionItem::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
1 call to RevisionItem::generateSampleValue()
- RevisionFieldTest::testFieldOperations in tests/
src/ Functional/ RevisionFieldTest.php
File
- src/
Plugin/ Field/ FieldType/ RevisionItem.php, line 91
Class
- RevisionItem
- Plugin annotation @FieldType( id = "revision_token", label = @Translation("Revision token"), description = @Translation("Entity revision token."), no_ui = TRUE )
Namespace
Drupal\multiversion\Plugin\Field\FieldTypeCode
public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
$i = rand(0, 99);
$hash = md5(rand());
$token = "{$i}-{$hash}";
return [
'value' => $token,
'new_edit' => TRUE,
'revisions' => [
$hash,
md5(rand()),
md5(rand()),
],
'is_stub' => FALSE,
];
}