public static function PriceItem::propertyDefinitions in Price 2.x
Same name and namespace in other branches
- 8 src/Plugin/Field/FieldType/PriceItem.php \Drupal\price\Plugin\Field\FieldType\PriceItem::propertyDefinitions()
- 3.x src/Plugin/Field/FieldType/PriceItem.php \Drupal\price\Plugin\Field\FieldType\PriceItem::propertyDefinitions()
- 2.0.x src/Plugin/Field/FieldType/PriceItem.php \Drupal\price\Plugin\Field\FieldType\PriceItem::propertyDefinitions()
- 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
File
- src/
Plugin/ Field/ FieldType/ PriceItem.php, line 29
Class
- PriceItem
- Plugin implementation of the 'price' field type.
Namespace
Drupal\price\Plugin\Field\FieldTypeCode
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);
$properties['formatted'] = DataDefinition::create('formatted_price')
->setLabel(t('Formatted price'))
->setRequired(FALSE);
return $properties;
}