You are here

public static function PriceTableItem::propertyDefinitions in Commerce Price Table 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

src/Plugin/Field/FieldType/PriceTableItem.php, line 79

Class

PriceTableItem
Plugin implementation of the 'commerce_price_table' field type.

Namespace

Drupal\commerce_price_table\Plugin\Field\FieldType

Code

public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
  $properties['amount'] = DataDefinition::create('string')
    ->setLabel(t('The price amount.'));
  $properties['currency_code'] = DataDefinition::create('string')
    ->setLabel(t('The currency code for the price.'));
  $properties['min_qty'] = DataDefinition::create('integer')
    ->setLabel(t('The minimal quantity for this amount.'))
    ->setDescription(t('Snippet code language'));
  $properties['max_qty'] = DataDefinition::create('integer')
    ->setLabel(t('The maximum quantity for this amount.'));
  $properties['data'] = DataDefinition::create('string')
    ->setLabel(t('A serialized array of additional price data.'));
  return $properties;
}