diff options
-rw-r--r-- | includes/common.inc | 14 | ||||
-rw-r--r-- | includes/file.inc | 4 | ||||
-rw-r--r-- | modules/comment/comment.module | 4 | ||||
-rw-r--r-- | modules/node/node.module | 2 | ||||
-rw-r--r-- | modules/system/system.api.php | 4 | ||||
-rw-r--r-- | modules/taxonomy/taxonomy.module | 8 | ||||
-rw-r--r-- | modules/user/user.module | 4 |
7 files changed, 11 insertions, 29 deletions
diff --git a/includes/common.inc b/includes/common.inc index 0cac24553..1722d206d 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -6630,20 +6630,6 @@ function entity_uri($entity_type, $entity) { } /** - * Invokes entity insert/update hooks. - * - * @param $op - * One of 'insert' or 'update'. - * @param $entity_type - * The entity type; e.g. 'node' or 'user'. - * @param $entity - * The entity object being operated on. - */ -function entity_invoke($op, $entity_type, $entity) { - module_invoke_all('entity_' . $op, $entity, $entity_type); -} - -/** * Helper function for attaching field API validation to entity forms. */ function entity_form_field_validate($entity_type, $form, &$form_state) { diff --git a/includes/file.inc b/includes/file.inc index b8cb28280..de05c799f 100644 --- a/includes/file.inc +++ b/includes/file.inc @@ -517,13 +517,13 @@ function file_save(stdClass $file) { drupal_write_record('file_managed', $file); // Inform modules about the newly added file. module_invoke_all('file_insert', $file); - entity_invoke('insert', 'file', $file); + module_invoke_all('entity_insert', $file, 'file'); } else { drupal_write_record('file_managed', $file, 'fid'); // Inform modules that the file has been updated. module_invoke_all('file_update', $file); - entity_invoke('update', 'file', $file); + module_invoke_all('entity_update', $file, 'file'); } return $file; diff --git a/modules/comment/comment.module b/modules/comment/comment.module index d54a33a9c..8b1041a5e 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -1451,7 +1451,7 @@ function comment_save($comment) { field_attach_update('comment', $comment); // Allow modules to respond to the updating of a comment. module_invoke_all('comment_update', $comment); - entity_invoke('update', 'comment', $comment); + module_invoke_all('entity_update', $comment, 'comment'); } else { // Add the comment to database. This next section builds the thread field. @@ -1540,7 +1540,7 @@ function comment_save($comment) { // Tell the other modules a new comment has been submitted. module_invoke_all('comment_insert', $comment); - entity_invoke('insert', 'comment', $comment); + module_invoke_all('entity_insert', $comment, 'comment'); } if ($comment->status == COMMENT_PUBLISHED) { module_invoke_all('comment_publish', $comment); diff --git a/modules/node/node.module b/modules/node/node.module index a5d9d770c..fc75cd795 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -1075,7 +1075,7 @@ function node_save($node) { $function('node', $node); module_invoke_all('node_' . $op, $node); - entity_invoke($op, 'node', $node); + module_invoke_all('entity_' . $op, $node, 'node'); // Update the node access table for this node. There's no need to delete // existing records if the node is new. diff --git a/modules/system/system.api.php b/modules/system/system.api.php index 522866073..6101c3fe1 100644 --- a/modules/system/system.api.php +++ b/modules/system/system.api.php @@ -261,8 +261,6 @@ function hook_entity_load($entities, $type) { /** * Act on entities when inserted. * - * Generic insert hook called for all entity types via entity_invoke(). - * * @param $entity * The entity object. * @param $type @@ -274,8 +272,6 @@ function hook_entity_insert($entity, $type) { /** * Act on entities when updated. * - * Generic update hook called for all entity types via entity_invoke(). - * * @param $entity * The entity object. * @param $type diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index 842bb656a..8d25355f0 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -378,13 +378,13 @@ function taxonomy_vocabulary_save($vocabulary) { if (!empty($vocabulary->vid) && !empty($vocabulary->name)) { $status = drupal_write_record('taxonomy_vocabulary', $vocabulary, 'vid'); module_invoke_all('taxonomy_vocabulary_update', $vocabulary); - entity_invoke('update', 'taxonomy_vocabulary', $vocabulary); + module_invoke_all('entity_update', $vocabulary, 'taxonomy_vocabulary'); } elseif (empty($vocabulary->vid)) { $status = drupal_write_record('taxonomy_vocabulary', $vocabulary); field_attach_create_bundle('taxonomy_term', $vocabulary->machine_name); module_invoke_all('taxonomy_vocabulary_insert', $vocabulary); - entity_invoke('insert', 'taxonomy_vocabulary', $vocabulary); + module_invoke_all('entity_insert', $vocabulary, 'taxonomy_vocabulary'); } cache_clear_all(); @@ -486,7 +486,7 @@ function taxonomy_term_save($term) { $status = drupal_write_record('taxonomy_term_data', $term); field_attach_insert('taxonomy_term', $term); module_invoke_all('taxonomy_term_insert', $term); - entity_invoke('insert', 'taxonomy_term', $term); + module_invoke_all('entity_insert', $term, 'taxonomy_term'); if (!isset($term->parent)) { $term->parent = array(0); } @@ -495,7 +495,7 @@ function taxonomy_term_save($term) { $status = drupal_write_record('taxonomy_term_data', $term, 'tid'); field_attach_update('taxonomy_term', $term); module_invoke_all('taxonomy_term_update', $term); - entity_invoke('update', 'taxonomy_term', $term); + module_invoke_all('entity_update', $term, 'taxonomy_term'); if (isset($term->parent)) { db_delete('taxonomy_term_hierarchy') ->condition('tid', $term->tid) diff --git a/modules/user/user.module b/modules/user/user.module index 7ce2e6ac8..8f226d613 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -511,7 +511,7 @@ function user_save($account, $edit = array(), $category = 'account') { } user_module_invoke('update', $edit, $user, $category); - entity_invoke('update', 'user', $user); + module_invoke_all('entity_update', $user, 'user'); } else { // Allow 'uid' to be set by the caller. There is no danger of writing an @@ -544,7 +544,7 @@ function user_save($account, $edit = array(), $category = 'account') { field_attach_insert('user', $user); user_module_invoke('insert', $edit, $user, $category); - entity_invoke('insert', 'user', $user); + module_invoke_all('entity_insert', $user, 'user'); // Save user roles. if (isset($edit['roles']) && is_array($edit['roles'])) { |