You are here

function commerce_order_field_storage_config_access in Commerce Core 8.2

Implements hook_ENTITY_TYPE_access().

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

File

modules/order/commerce_order.module, line 367
Defines the Order entity and associated features.

Code

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