You are here

public static function BatCalendarUnitReference::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/BatCalendarUnitReference.php, line 56
Contains \Drupal\bat_calendar_reference\Plugin\Field\FieldType\BatCalendarUnitReference.

Class

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

Namespace

Drupal\bat_calendar_reference\Plugin\Field\FieldType

Code

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