function commerce_customer_profile_can_delete in Commerce Core 7
Determines whether or not the give customer profile can be deleted.
Parameters
$profile: The customer profile to be checked for deletion.
Return value
Boolean indicating whether or not the customer profile can be deleted.
4 calls to commerce_customer_profile_can_delete()
- CommerceCustomerProfileEntityController::delete in modules/
customer/ includes/ commerce_customer_profile.controller.inc - Deletes multiple customer profiles by ID.
- commerce_customer_field_widget_form in modules/
customer/ commerce_customer.module - Implements hook_field_widget_form().
- commerce_customer_profile_manager_validate in modules/
customer/ commerce_customer.module - Validation callback for a commerce_customer_profile_manager element.
- commerce_order_field_attach_form in modules/
order/ commerce_order.module - Implements hook_field_attach_form().
File
- modules/
customer/ commerce_customer.module, line 641 - Defines the customer profile entity and API functions to manage customers and interact with them.
Code
function commerce_customer_profile_can_delete($profile) {
// Return FALSE if the given profile does not have an ID; it need not be
// deleted, which is functionally equivalent to cannot be deleted as far as
// code depending on this function is concerned.
if (empty($profile->profile_id)) {
return FALSE;
}
// If any module implementing hook_commerce_customer_profile_can_delete()
// returns FALSE the customer profile cannot be deleted. Return TRUE if none
// return FALSE.
return !in_array(FALSE, module_invoke_all('commerce_customer_profile_can_delete', $profile));
}