public static function PrivateItem::propertyDefinitions in Private content 8.2
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/ PrivateItem.php, line 48
Class
- PrivateItem
- Plugin implementation for the PrivateItem field type.
Namespace
Drupal\private_content\Plugin\Field\FieldTypeCode
public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
$properties['stored'] = DataDefinition::create('boolean')
->setLabel(t('Stored value'))
->setRequired(TRUE);
$properties['value'] = DataDefinition::create('boolean')
->setLabel(t('Usable value'))
->setDescription(t('Calculated value taking into account the content type settings.'))
->setComputed(TRUE)
->setClass('\\Drupal\\private_content\\PrivateComputed');
return $properties;
}