You are here

public function DefaultDateRecurOccurrenceHandler::occurrencePropertyDefinition in Recurring Dates Field 8

Parameters

\Drupal\Core\Field\FieldStorageDefinitionInterface $field_definition:

Return value

DataDefinitionInterface

Overrides DateRecurOccurrenceHandlerInterface::occurrencePropertyDefinition

File

src/Plugin/DateRecurOccurrenceHandler/DefaultDateRecurOccurrenceHandler.php, line 436

Class

DefaultDateRecurOccurrenceHandler
Provides the default occurrence handler.

Namespace

Drupal\date_recur\Plugin\DateRecurOccurrenceHandler

Code

public function occurrencePropertyDefinition(FieldStorageDefinitionInterface $field_definition) {
  $occurrence = MapDataDefinition::create()
    ->setPropertyDefinition('value', DataDefinition::create('datetime_iso8601')
    ->setLabel(t('Occurrence start date')))
    ->setPropertyDefinition('end_value', DataDefinition::create('datetime_iso8601')
    ->setLabel(t('Occurrence end date')));
  $occurrences = ListDataDefinition::create('map')
    ->setItemDefinition($occurrence)
    ->setLabel(t('Occurrences'))
    ->setComputed(true)
    ->setClass(DateRecurOccurrencesComputed::class);
  return $occurrences;
}