function DateRangeItem::propertyDefinitions

Same name in other branches
  1. 9 core/modules/datetime_range/src/Plugin/Field/FieldType/DateRangeItem.php \Drupal\datetime_range\Plugin\Field\FieldType\DateRangeItem::propertyDefinitions()
  2. 8.9.x core/modules/datetime_range/src/Plugin/Field/FieldType/DateRangeItem.php \Drupal\datetime_range\Plugin\Field\FieldType\DateRangeItem::propertyDefinitions()
  3. 11.x core/modules/datetime_range/src/Plugin/Field/FieldType/DateRangeItem.php \Drupal\datetime_range\Plugin\Field\FieldType\DateRangeItem::propertyDefinitions()

Overrides DateTimeItem::propertyDefinitions

File

core/modules/datetime_range/src/Plugin/Field/FieldType/DateRangeItem.php, line 41

Class

DateRangeItem
Plugin implementation of the 'daterange' field type.

Namespace

Drupal\datetime_range\Plugin\Field\FieldType

Code

public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
    $properties['value'] = DataDefinition::create('datetime_iso8601')->setLabel(t('Start date value'))
        ->setRequired(TRUE);
    $properties['start_date'] = 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('datetime_iso8601')->setLabel(t('End date value'))
        ->setRequired(TRUE);
    $properties['end_date'] = 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');
    return $properties;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.