diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/common.inc | 13 | ||||
-rw-r--r-- | includes/file.inc | 2 |
2 files changed, 15 insertions, 0 deletions
diff --git a/includes/common.inc b/includes/common.inc index 20b0648c7..d04f938ea 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -6575,6 +6575,19 @@ function entity_path($entity_type, $entity) { return $info['path callback']($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); +} /** * Performs one or more XML-RPC request(s). diff --git a/includes/file.inc b/includes/file.inc index ccac9cabc..b03e9d4d9 100644 --- a/includes/file.inc +++ b/includes/file.inc @@ -512,11 +512,13 @@ function file_save(stdClass $file) { drupal_write_record('file', $file); // Inform modules about the newly added file. module_invoke_all('file_insert', $file); + entity_invoke('insert', 'file', $file); } else { drupal_write_record('file', $file, 'fid'); // Inform modules that the file has been updated. module_invoke_all('file_update', $file); + entity_invoke('update', 'file', $file); } return $file; |