You are here

function commerce_order_profile_type_access in Commerce Core 8.2

Implements hook_ENTITY_TYPE_access().

Forbids the "customer" profile type from being deletable.

File

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

Code

function commerce_order_profile_type_access(ProfileTypeInterface $profile_type, $operation, AccountInterface $account) {
  if ($profile_type
    ->id() === 'customer' && $operation === 'delete') {
    return AccessResult::forbidden();
  }
  return AccessResult::neutral();
}