public static function BatTypeOptions::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_options/ src/ Plugin/ Field/ FieldType/ BatTypeOptions.php, line 72 - Contains \Drupal\bat_options\Plugin\Field\FieldType\BatTypeOptions.
Class
- BatTypeOptions
- Plugin annotation @FieldType( id = "bat_options", label = @Translation("BAT Type Options"), description = @Translation("BAT Type Options."), default_widget = "bat_options_combined", default_formatter = "bat_options_default" )
Namespace
Drupal\bat_options\Plugin\Field\FieldTypeCode
public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
$properties['name'] = DataReferenceTargetDefinition::create('string')
->setLabel(t('Name'));
$properties['quantity'] = DataReferenceTargetDefinition::create('integer')
->setLabel(t('Quantity'));
$properties['operation'] = DataReferenceTargetDefinition::create('string')
->setLabel(t('Operation'));
$properties['value'] = DataReferenceTargetDefinition::create('float')
->setLabel(t('Value'));
$properties['type'] = DataReferenceTargetDefinition::create('string')
->setLabel(t('Type'));
return $properties;
}