You are here

function profile2_profile2_type_delete in Profile 2 7.2

Same name and namespace in other branches
  1. 7 profile2.module \profile2_profile2_type_delete()

Implements hook_profile2_type_delete()

File

./profile2.module, line 549
Support for configurable user profiles.

Code

function profile2_profile2_type_delete(ProfileType $type) {

  // Delete all profiles of this type but only if this is not a revert.
  if (!$type
    ->hasStatus(ENTITY_IN_CODE)) {
    $pids = array_keys(profile2_load_multiple(FALSE, array(
      'type' => $type->type,
    )));
    if ($pids) {
      profile2_delete_multiple($pids);
    }

    // @see profile2_profile2_type_insert()
    variable_set('menu_rebuild_needed', TRUE);
  }
}