From 108442503a2c1d37e36a090705c27a0819c99f1b Mon Sep 17 00:00:00 2001
From: that0n3guy <peter@quadputer>
Date: Mon, 10 Oct 2011 10:13:58 -0500
Subject: [PATCH] added rate_embed_comment function

---
 rate.module |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/rate.module b/rate.module
index 4b8c12e..5a1c535 100644
--- a/rate.module
+++ b/rate.module
@@ -629,6 +629,25 @@ function rate_embed(&$node, $machine_name, $mode = RATE_FULL) {
 }
 
 /**
+ * Get the widget code to embed.
+ *
+ * @param init - comment id $cid
+ * @param string - node type - $type
+ * @param int $mode
+ */
+function rate_embed_comment($cid, $machine_name, $type, $mode = RATE_FULL) {
+  // Adding the form to the node view
+  $widgets = rate_get_active_widgets('comment', $type, 'full');
+  foreach ($widgets as $widget_id => $widget) {
+    if ($widget->name != $machine_name) {
+      continue;
+    }
+    return rate_generate_widget($widget_id, 'comment', $cid, $mode);
+  }
+  return FALSE;
+}
+
+/**
  * Implements hook_comment_view_alter().
  */
 function rate_comment_view_alter(&$comment) {
-- 
1.7.0.4

