You are here

function commerce_extra_panes_entity_delete in Commerce extra panes 7

Implements hook_entity_delete().

File

./commerce_extra_panes.module, line 197
Module file for Drupal Commerce Extra panes.

Code

function commerce_extra_panes_entity_delete($entity, $type) {
  list($id) = entity_extract_ids($type, $entity);
  $panes = commerce_extra_panes_get_panes($id, $type);
  $extra_pane = reset($panes);
  if (!empty($extra_pane) && !empty($extra_pane->extra_id)) {
    $affected_rows = db_delete('commerce_extra_panes')
      ->condition('extra_id', $extra_pane->extra_id)
      ->condition('extra_type', $type)
      ->execute();
    if ($affected_rows) {
      drupal_set_message(t('Corresponding Commerce extra pane was deleted.'), 'warning');
    }
  }
}