function commerce_tax_entity_base_field_info in Commerce Core 8.2
Implements hook_entity_base_field_info().
File
- modules/
tax/ commerce_tax.module, line 29 - Provides tax functionality.
Code
function commerce_tax_entity_base_field_info(EntityTypeInterface $entity_type) {
if ($entity_type
->id() === 'commerce_store') {
$fields['prices_include_tax'] = BaseFieldDefinition::create('boolean')
->setLabel(t('Prices are entered with taxes included.'))
->setDisplayOptions('form', [
'type' => 'boolean_checkbox',
'settings' => [
'display_label' => TRUE,
],
'weight' => 3,
])
->setDisplayConfigurable('view', TRUE)
->setDisplayConfigurable('form', TRUE)
->setDefaultValue(FALSE);
$fields['tax_registrations'] = BaseFieldDefinition::create('list_string')
->setLabel(t('Tax registrations'))
->setDescription(t('The countries where the store is additionally registered to collect taxes.'))
->setCardinality(BaseFieldDefinition::CARDINALITY_UNLIMITED)
->setSetting('allowed_values_function', [
'\\Drupal\\commerce_store\\Entity\\Store',
'getAvailableCountries',
])
->setDisplayOptions('form', [
'type' => 'options_select',
'weight' => 4,
])
->setDisplayConfigurable('view', TRUE)
->setDisplayConfigurable('form', TRUE);
return $fields;
}
}