You are here

function rules_entity_presave in Rules 7.2

Same name and namespace in other branches
  1. 8.3 rules.module \rules_entity_presave()

Implements hook_entity_presave().

Related topics

File

modules/events.inc, line 63
Invokes events on behalf core modules.

Code

function rules_entity_presave($entity, $type) {
  switch ($type) {
    case 'comment':
      rules_invoke_event('comment_presave--' . $entity->node_type, $entity);
      rules_invoke_event('comment_presave', $entity);
      break;
    case 'node':
      rules_invoke_event('node_presave--' . $entity->type, $entity);
      rules_invoke_event('node_presave', $entity);
      break;
    case 'taxonomy_term':
      rules_invoke_event('taxonomy_term_presave--' . $entity->vocabulary_machine_name, $entity);
      rules_invoke_event('taxonomy_term_presave', $entity);
      break;
    case 'taxonomy_vocabulary':
    case 'user':
      rules_invoke_event($type . '_presave', $entity);
      break;
  }
}