You are here

public static function PriceItem::propertyDefinitions in Price 8

Same name and namespace in other branches
  1. 3.x src/Plugin/Field/FieldType/PriceItem.php \Drupal\price\Plugin\Field\FieldType\PriceItem::propertyDefinitions()
  2. 2.0.x src/Plugin/Field/FieldType/PriceItem.php \Drupal\price\Plugin\Field\FieldType\PriceItem::propertyDefinitions()
  3. 2.x src/Plugin/Field/FieldType/PriceItem.php \Drupal\price\Plugin\Field\FieldType\PriceItem::propertyDefinitions()
  4. 3.0.x src/Plugin/Field/FieldType/PriceItem.php \Drupal\price\Plugin\Field\FieldType\PriceItem::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 FieldItemInterface::propertyDefinitions

See also

\Drupal\Core\Field\BaseFieldDefinition

1 call to PriceItem::propertyDefinitions()
PriceModifiedItem::propertyDefinitions in src/Plugin/Field/FieldType/PriceModifiedItem.php
Defines field item properties.
1 method overrides PriceItem::propertyDefinitions()
PriceModifiedItem::propertyDefinitions in src/Plugin/Field/FieldType/PriceModifiedItem.php
Defines field item properties.

File

src/Plugin/Field/FieldType/PriceItem.php, line 28

Class

PriceItem
Plugin implementation of the 'price' field type.

Namespace

Drupal\price\Plugin\Field\FieldType

Code

public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
  $properties['number'] = DataDefinition::create('string')
    ->setLabel(t('Number'))
    ->setRequired(FALSE);
  $properties['currency_code'] = DataDefinition::create('string')
    ->setLabel(t('Currency code'))
    ->setRequired(FALSE);
  return $properties;
}