From 1fb5f62ba56bdbc6ff9f8a4045bccca8c5b9decd Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 30 Nov 2010 19:31:47 +0000 Subject: - Patch #651240 by fago, sun: allow modules to react to changes to an entity. --- modules/comment/comment.module | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'modules/comment') 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'); -- cgit v1.2.3