You are here

function bat_unit_entity_delete in Booking and Availability Management Tools for Drupal 7

Same name and namespace in other branches
  1. 8 modules/bat_unit/bat_unit.module \bat_unit_entity_delete()

Implements hook_entity_delete().

File

modules/bat_unit/bat_unit.module, line 521

Code

function bat_unit_entity_delete($entity, $type) {
  if ($type == 'bat_type') {

    // When delete a Type remove all related Units.
    $units = bat_unit_load_multiple(FALSE, array(
      'type_id' => $entity->type_id,
    ));
    foreach ($units as $unit) {
      $unit
        ->delete();
    }
  }
}