function commerce_payment_entity_base_field_info in Commerce Core 8.2
Implements hook_entity_base_field_info().
File
- modules/
payment/ commerce_payment.module, line 29 - Provides payment functionality.
Code
function commerce_payment_entity_base_field_info(EntityTypeInterface $entity_type) {
if ($entity_type
->id() === 'commerce_order') {
$fields['payment_gateway'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Payment gateway'))
->setDescription(t('The payment gateway.'))
->setSetting('target_type', 'commerce_payment_gateway');
$fields['payment_method'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Payment method'))
->setDescription(t('The payment method.'))
->setSetting('target_type', 'commerce_payment_method');
return $fields;
}
}