You are here

function commerce_tax_field_storage_config_access in Commerce Core 8.2

Implements hook_ENTITY_TYPE_access().

Forbids the profile "tax_number" field from being deletable. This is an alternative to locking the field which still leaves the field editable.

File

modules/tax/commerce_tax.module, line 67
Provides tax functionality.

Code

function commerce_tax_field_storage_config_access(FieldStorageConfigInterface $field_storage, $operation) {
  if ($field_storage
    ->id() == 'profile.tax_number' && $operation == 'delete') {
    return AccessResult::forbidden();
  }
  return AccessResult::neutral();
}