You are here

public function PurchaseOrder::buildFieldDefinitions in Commerce Purchase Order 8

Same name in this branch
  1. 8 src/Plugin/Commerce/PaymentType/PurchaseOrder.php \Drupal\commerce_purchase_order\Plugin\Commerce\PaymentType\PurchaseOrder::buildFieldDefinitions()
  2. 8 src/Plugin/Commerce/PaymentMethodType/PurchaseOrder.php \Drupal\commerce_purchase_order\Plugin\Commerce\PaymentMethodType\PurchaseOrder::buildFieldDefinitions()

Builds the field definitions for entities of this bundle.

Important: Field names must be unique across all bundles. It is recommended to prefix them with the bundle name (plugin ID).

Return value

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

Overrides PaymentMethodTypeBase::buildFieldDefinitions

File

src/Plugin/Commerce/PaymentMethodType/PurchaseOrder.php, line 38

Class

PurchaseOrder
Provides the Purchase Order payment method type.

Namespace

Drupal\commerce_purchase_order\Plugin\Commerce\PaymentMethodType

Code

public function buildFieldDefinitions() {
  $fields = parent::buildFieldDefinitions();
  $fields['po_number'] = BundleFieldDefinition::create('string')
    ->setLabel(t('Purchase Order Number'))
    ->setDescription(t('The number assigned to your purchase order.'))
    ->setRequired(TRUE);
  return $fields;
}