public static function RevisionItem::propertyDefinitions in Multiversion 8
Same name and namespace in other branches
- 8.2 src/Plugin/Field/FieldType/RevisionItem.php \Drupal\multiversion\Plugin\Field\FieldType\RevisionItem::propertyDefinitions()
Defines field item properties.
Properties that are required to constitute a valid, non-empty item should be denoted with \Drupal\Core\TypedData\DataDefinition::setRequired().
Return value
\Drupal\Core\TypedData\DataDefinitionInterface[] An array of property definitions of contained properties, keyed by property name.
Overrides FieldItemInterface::propertyDefinitions
See also
\Drupal\Core\Field\BaseFieldDefinition
File
- src/
Plugin/ Field/ FieldType/ RevisionItem.php, line 23
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 propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
$properties['value'] = DataDefinition::create('string')
->setLabel(t('Revision token'))
->setRequired(TRUE);
$properties['new_edit'] = DataDefinition::create('boolean')
->setLabel(t('New edit flag'))
->setDescription(t('During replication this will be set to FALSE to ensure that the revision is saved as-is without generating a new token.'))
->setRequired(FALSE)
->setComputed(TRUE)
->setClass('\\Drupal\\multiversion\\NewEdit');
// Field item properties can't be lists for some good reason, so we define
// it as a string here, but in reality it will be used as an array. It does
// not matter much because this field is computed and will not be stored.
$properties['revisions'] = DataDefinition::create('string')
->setLabel(t('A list of all known revisions of the entity.'))
->setDescription(t('During replication this will be populated with hashes (i.e. without the index prefix) from all known revisions of the entity.'))
->setRequired(FALSE)
->setComputed(TRUE)
->setClass('\\Drupal\\multiversion\\Field\\RevisionsProperty');
$properties['is_stub'] = DataDefinition::create('boolean')
->setLabel(t('Is stub flag'))
->setDescription(t('This will be true just in case if the current revision is the children of a stub revision.'))
->setRequired(FALSE)
->setComputed(TRUE)
->setClass('\\Drupal\\multiversion\\IsStub');
return $properties;
}