public static function SmartDateItem::propertyDefinitions in Smart Date 3.3.x
Same name and namespace in other branches
- 8.2 src/Plugin/Field/FieldType/SmartDateItem.php \Drupal\smart_date\Plugin\Field\FieldType\SmartDateItem::propertyDefinitions()
- 8 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.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);
$properties['rrule'] = DataDefinition::create('integer')
->setLabel(t('RRule ID'))
->setSetting('unsigned', TRUE)
->setRequired(FALSE);
$properties['rrule_index'] = DataDefinition::create('integer')
->setLabel(t('RRule Index'))
->setSetting('unsigned', TRUE)
->setRequired(FALSE);
$properties['timezone'] = DataDefinition::create('string')
->setLabel(t('Timezone'))
->setDescription(t('The timezone of this date.'))
->setSetting('max_length', 32)
->setRequired(FALSE)
->addConstraint('AllowedValues', array_keys(system_time_zones(TRUE, FALSE)));
return $properties;
}