public static function SmartDateItem::propertyDefinitions in Smart Date 8
Same name and namespace in other branches
- 8.2 src/Plugin/Field/FieldType/SmartDateItem.php \Drupal\smart_date\Plugin\Field\FieldType\SmartDateItem::propertyDefinitions()
- 3.x src/Plugin/Field/FieldType/SmartDateItem.php \Drupal\smart_date\Plugin\Field\FieldType\SmartDateItem::propertyDefinitions()
- 3.0.x src/Plugin/Field/FieldType/SmartDateItem.php \Drupal\smart_date\Plugin\Field\FieldType\SmartDateItem::propertyDefinitions()
- 3.1.x src/Plugin/Field/FieldType/SmartDateItem.php \Drupal\smart_date\Plugin\Field\FieldType\SmartDateItem::propertyDefinitions()
- 3.2.x src/Plugin/Field/FieldType/SmartDateItem.php \Drupal\smart_date\Plugin\Field\FieldType\SmartDateItem::propertyDefinitions()
- 3.3.x src/Plugin/Field/FieldType/SmartDateItem.php \Drupal\smart_date\Plugin\Field\FieldType\SmartDateItem::propertyDefinitions()
- 3.4.x src/Plugin/Field/FieldType/SmartDateItem.php \Drupal\smart_date\Plugin\Field\FieldType\SmartDateItem::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 TimestampItem::propertyDefinitions
See also
\Drupal\Core\Field\BaseFieldDefinition
File
- src/
Plugin/ Field/ FieldType/ SmartDateItem.php, line 28
Class
- SmartDateItem
- Plugin implementation of the 'smartdate' field type.
Namespace
Drupal\smart_date\Plugin\Field\FieldTypeCode
public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
$properties['value'] = DataDefinition::create('timestamp')
->setLabel(t('Start timestamp value'))
->setRequired(TRUE);
$properties['start_time'] = DataDefinition::create('any')
->setLabel(t('Computed start date'))
->setDescription(t('The computed start DateTime object.'))
->setComputed(TRUE)
->setClass(DateTimeComputed::class)
->setSetting('date source', 'value');
$properties['end_value'] = DataDefinition::create('timestamp')
->setLabel(t('End timestamp value'))
->setRequired(TRUE);
$properties['end_time'] = DataDefinition::create('any')
->setLabel(t('Computed end date'))
->setDescription(t('The computed end DateTime object.'))
->setComputed(TRUE)
->setClass(DateTimeComputed::class)
->setSetting('date source', 'end_value');
$properties['duration'] = DataDefinition::create('integer')
->setLabel(t('Duration, in minutes'))
->setRequired(FALSE);
// TODO: figure out a way to validate as required but accept zero.
return $properties;
}