You are here

public function PurchasableEntityDryIce::buildFieldDefinitions in Commerce FedEx 8

Builds the field definitions.

THe provided field definitions will be created as configurable fields when the entity trait is installed for an entity type/bundle.

Return value

\Drupal\entity\BundleFieldDefinition[] An array of field definitions, keyed by field name.

Overrides EntityTraitBase::buildFieldDefinitions

File

modules/dry_ice/src/Plugin/Commerce/EntityTrait/PurchasableEntityDryIce.php, line 21

Class

PurchasableEntityDryIce
Provides the "fedex_dry_ice" trait.

Namespace

Drupal\commerce_fedex_dry_ice\Plugin\Commerce\EntityTrait

Code

public function buildFieldDefinitions() {
  $id = $this
    ->getPluginId();
  $fields = [];
  $fields[$id . '_domestic'] = BundleFieldDefinition::create('boolean')
    ->setLabel("FedEx: Require dry ice shipping domestically")
    ->setDisplayOptions('form', [
    'type' => 'boolean_checkbox',
    'weight' => 95,
  ]);
  $fields[$id . '_intl'] = BundleFieldDefinition::create('boolean')
    ->setLabel("FedEx: Require dry ice shipping internationally")
    ->setDisplayOptions('form', [
    'type' => 'boolean_checkbox',
    'weight' => 95,
  ]);
  return $fields;
}