public static function SubscriptionItem::propertyDefinitions in Simplenews 8
Same name and namespace in other branches
- 8.2 src/Plugin/Field/FieldType/SubscriptionItem.php \Drupal\simplenews\Plugin\Field\FieldType\SubscriptionItem::propertyDefinitions()
- 3.x src/Plugin/Field/FieldType/SubscriptionItem.php \Drupal\simplenews\Plugin\Field\FieldType\SubscriptionItem::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 EntityReferenceItem::propertyDefinitions
See also
\Drupal\Core\Field\BaseFieldDefinition
File
- src/
Plugin/ Field/ FieldType/ SubscriptionItem.php, line 36
Class
- SubscriptionItem
- Defines the 'subscription' entity field type (extended entity_reference).
Namespace
Drupal\simplenews\Plugin\Field\FieldTypeCode
public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
// Call the parent to define the target_id and entity properties.
$properties = parent::propertyDefinitions($field_definition);
$properties['status'] = DataDefinition::create('integer')
->setLabel(t('Status'))
->setSetting('unsigned', TRUE);
$properties['timestamp'] = DataDefinition::create('timestamp')
->setLabel(t('Timestamp'));
$properties['source'] = DataDefinition::create('string')
->setLabel(t('Source'));
return $properties;
}