You are here

public static function DateRecurItem::propertyDefinitions in Recurring Dates Field 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldType/DateRecurItem.php \Drupal\date_recur\Plugin\Field\FieldType\DateRecurItem::propertyDefinitions()
  2. 3.x src/Plugin/Field/FieldType/DateRecurItem.php \Drupal\date_recur\Plugin\Field\FieldType\DateRecurItem::propertyDefinitions()
  3. 3.0.x src/Plugin/Field/FieldType/DateRecurItem.php \Drupal\date_recur\Plugin\Field\FieldType\DateRecurItem::propertyDefinitions()
  4. 3.1.x src/Plugin/Field/FieldType/DateRecurItem.php \Drupal\date_recur\Plugin\Field\FieldType\DateRecurItem::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 DateRangeItem::propertyDefinitions

See also

\Drupal\Core\Field\BaseFieldDefinition

File

src/Plugin/Field/FieldType/DateRecurItem.php, line 35

Class

DateRecurItem
Plugin implementation of the 'date_recur' field type.

Namespace

Drupal\date_recur\Plugin\Field\FieldType

Code

public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
  $properties = parent::propertyDefinitions($field_definition);

  // Prevent early t() calls by using the TranslatableMarkup.
  $properties['timezone'] = DataDefinition::create('string')
    ->setLabel(new TranslatableMarkup('Timezone'))
    ->setRequired(FALSE);
  $properties['rrule'] = DataDefinition::create('string')
    ->setLabel(new TranslatableMarkup('RRule'))
    ->setRequired(FALSE);
  $properties['infinite'] = DataDefinition::create('boolean')
    ->setLabel(new TranslatableMarkup('Is the RRule an infinite rule?'))
    ->setRequired(FALSE);
  $handler = date_recur_create_occurrence_handler($field_definition);
  $properties['occurrences'] = $handler
    ->occurrencePropertyDefinition($field_definition);
  return $properties;
}