function rules_entity_delete

Same name in other branches
  1. 8.x-3.x rules.module \rules_entity_delete()

Implements hook_entity_delete().

Related topics

File

modules/events.inc, line 144

Code

function rules_entity_delete($entity, $type) {
    switch ($type) {
        case 'comment':
            rules_invoke_event('comment_delete--' . $entity->node_type, $entity);
            rules_invoke_event('comment_delete', $entity);
            break;
        case 'node':
            rules_invoke_event('node_delete--' . $entity->type, $entity);
            rules_invoke_event('node_delete', $entity);
            break;
        case 'taxonomy_term':
            rules_invoke_event('taxonomy_term_delete--' . $entity->vocabulary_machine_name, $entity);
            rules_invoke_event('taxonomy_term_delete', $entity);
            break;
        case 'taxonomy_vocabulary':
        case 'user':
            rules_invoke_event($type . '_delete', $entity);
            break;
    }
}