public function OrderItemLicensed::buildFieldDefinitions in Commerce License 8.2
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
- src/
Plugin/ Commerce/ EntityTrait/ OrderItemLicensed.php, line 32
Class
- OrderItemLicensed
- Provides an entity trait for Commerce Order Item entities.
Namespace
Drupal\commerce_license\Plugin\Commerce\EntityTraitCode
public function buildFieldDefinitions() {
// Builds the field definitions.
$fields = [];
$fields['license'] = BundleFieldDefinition::create('entity_reference')
->setLabel(t('License'))
->setDescription(t('The license purchased with this order item.'))
->setSetting('target_type', 'commerce_license')
->setSetting('handler', 'default')
->setCardinality(1)
->setRequired(FALSE)
->setDisplayConfigurable('form', FALSE)
->setDisplayConfigurable('view', FALSE);
return $fields;
}