You are here

public static function BatCalendarUnitTypeReference::propertyDefinitions in Booking and Availability Management Tools for Drupal 8

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 FieldItemInterface::propertyDefinitions

See also

\Drupal\Core\Field\BaseFieldDefinition

File

modules/bat_calendar_reference/src/Plugin/Field/FieldType/BatCalendarUnitTypeReference.php, line 56
Contains \Drupal\bat_calendar_reference\Plugin\Field\FieldType\BatCalendarUnitTypeReference.

Class

BatCalendarUnitTypeReference
Plugin annotation @FieldType( id = "bat_calendar_unit_type_reference", label = @Translation("BAT Calendar Unit Type Reference"), description = @Translation("Display unit type events information embedded from other fieldable content."), …

Namespace

Drupal\bat_calendar_reference\Plugin\Field\FieldType

Code

public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
  $properties['unit_type_id'] = DataReferenceTargetDefinition::create('integer')
    ->setLabel(t('Unit type id'))
    ->setSetting('unsigned', TRUE);
  $properties['event_type_id'] = DataReferenceTargetDefinition::create('string')
    ->setLabel(t('Event type id'));
  return $properties;
}