You are here

public static function BundleItemSelection::propertyDefinitions in Commerce Product Bundle 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/BundleItemSelection.php, line 51

Class

BundleItemSelection
Plugin implementation of the 'commerce_product_bundle_item_selection' field type.

Namespace

Drupal\commerce_product_bundle\Plugin\Field\FieldType

Code

public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
  $properties['bundle_item'] = DataDefinition::create('string')
    ->setLabel(t('Bundle item'))
    ->setRequired(FALSE);
  $properties['selected_qty'] = DataDefinition::create('string')
    ->setLabel(t('Selected quantity'))
    ->setRequired(FALSE);
  $properties['selected_entity'] = DataDefinition::create('string')
    ->setLabel(t('Selected entity'))
    ->setRequired(FALSE);
  return $properties;
}