You are here

function units_units_measure_delete in Units of Measurement 7

Same name and namespace in other branches
  1. 7.2 units.module \units_units_measure_delete()

Implements hook_ENTITY_TYPE_delete().

File

./units.module, line 197
Provide API for managing and converting units of measurement.

Code

function units_units_measure_delete($entity) {

  // Additionally delete units defined in the measure that is being deleted.
  $ids = array();
  foreach (units_unit_by_measure_load_multiple($entity) as $unit) {
    $tmp = entity_extract_ids('units_unit', $unit);
    $ids[] = $tmp[0];
  }
  units_unit_delete_multiple($ids);
}