function rules_entity_insert

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

Implements hook_entity_insert().

Related topics

File

modules/events.inc, line 117

Code

function rules_entity_insert($entity, $type) {
    switch ($type) {
        case 'comment':
            rules_invoke_event('comment_insert--' . $entity->node_type, $entity);
            rules_invoke_event('comment_insert', $entity);
            break;
        case 'node':
            rules_invoke_event('node_insert--' . $entity->type, $entity);
            rules_invoke_event('node_insert', $entity);
            break;
        case 'taxonomy_term':
            rules_invoke_event('taxonomy_term_insert--' . $entity->vocabulary_machine_name, $entity);
            rules_invoke_event('taxonomy_term_insert', $entity);
            break;
        case 'taxonomy_vocabulary':
        case 'user':
            rules_invoke_event($type . '_insert', $entity);
            break;
    }
}