diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-11-30 19:31:47 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-11-30 19:31:47 +0000 |
commit | 1fb5f62ba56bdbc6ff9f8a4045bccca8c5b9decd (patch) | |
tree | 2160f4d43f9da6385d200a04ee470c08b022c69e /modules/comment/comment.module | |
parent | 96b74a1594456dc1879df03222656e0dec815ad6 (diff) | |
download | brdo-1fb5f62ba56bdbc6ff9f8a4045bccca8c5b9decd.tar.gz brdo-1fb5f62ba56bdbc6ff9f8a4045bccca8c5b9decd.tar.bz2 |
- Patch #651240 by fago, sun: allow modules to react to changes to an entity.
Diffstat (limited to 'modules/comment/comment.module')
-rw-r--r-- | modules/comment/comment.module | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 96b399b77..b279ef324 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -1442,6 +1442,11 @@ function comment_save($comment) { $comment->node_type = 'comment_node_' . $node->type; } + // Load the stored entity, if any. + if (!empty($comment->cid) && !isset($comment->original)) { + $comment->original = entity_load_unchanged('comment', $comment->cid); + } + field_attach_presave('comment', $comment); // Allow modules to alter the comment before saving. @@ -1568,6 +1573,7 @@ function comment_save($comment) { if ($comment->status == COMMENT_PUBLISHED) { module_invoke_all('comment_publish', $comment); } + unset($comment->original); } catch (Exception $e) { $transaction->rollback('comment'); |