public function First::buildFieldDefinitions in Commerce Core 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
- tests/
modules/ commerce_test/ src/ Plugin/ Commerce/ EntityTrait/ First.php, line 22
Class
- First
- Provides the first entity trait.
Namespace
Drupal\commerce_test\Plugin\Commerce\EntityTraitCode
public function buildFieldDefinitions() {
$fields = [];
$fields['phone'] = BundleFieldDefinition::create('telephone')
->setLabel(t('Phone'))
->setRequired(TRUE);
return $fields;
}