diff -urp rate/rate.admin.inc rate/rate.admin.inc --- rate/rate.admin.inc 2010-11-05 07:24:49.000000000 -0700 +++ rate/rate.admin.inc 2010-12-04 17:49:09.000000000 -0800 @@ -381,6 +381,7 @@ function rate_widget_form(&$form_state, RATE_DISPLAY_DISABLE => t('Do not add automatically'), RATE_DISPLAY_ABOVE_CONTENT => t('Above the content'), RATE_DISPLAY_BELOW_CONTENT => t('Below the content'), + RATE_DISPLAY_LINKS => t('Links'), ); $form['display']['node_display'] = array( '#type' => 'radios', diff -urp rate/rate.module rate/rate.module --- rate/rate.module 2010-10-27 13:04:45.000000000 -0700 +++ rate/rate.module 2010-12-05 22:14:34.000000000 -0800 @@ -16,6 +16,7 @@ define('RATE_CLOSED', 4); define('RATE_DISPLAY_DISABLE', 0); define('RATE_DISPLAY_ABOVE_CONTENT', 1); define('RATE_DISPLAY_BELOW_CONTENT', 2); +define('RATE_DISPLAY_LINKS', 3); // Define modes for behaviour with users w/o permission to vote. define('RATE_NOPERM_REDIRECT_WITH_MESSAGE', 1); @@ -466,7 +467,7 @@ function rate_nodeapi(&$node, $op, $a3, '#value' => rate_generate_widget($widget_id, 'node', $node->nid), '#weight' => $widget->node_display == RATE_DISPLAY_ABOVE_CONTENT ? 0 : 50, ); - if ($widget->node_display == RATE_DISPLAY_DISABLE) { + if ($widget->node_display != RATE_DISPLAY_ABOVE_CONTENT && $widget->node_display != RATE_DISPLAY_BELOW_CONTENT) { $node->$widget_name = $widget_code; } else { @@ -503,6 +504,47 @@ function rate_comment(&$comment, $op) { } /** + * Implements hook_link() + */ +function rate_link($type, $object, $teaser = FALSE) { + $links = array(); + + // Adding widget to node links + if ($type == 'node') { + $widgets = rate_get_active_widgets('node', $object->type, $teaser); + foreach ($widgets as $widget_id => $widget) { + $widget_name = 'rate_' . $widget->name; + $widget_code = rate_generate_widget($widget_id, 'node', $object->nid); + isset($widget->node_display) or $widget->node_display = RATE_DISPLAY_BELOW_CONTENT; + if ($widget->node_display == RATE_DISPLAY_LINKS) { + $links[$widget_name] = array( + 'title' => $widget_code, + 'html' => TRUE, + ); + } + } + } + + // Adding widget to comment links + if ($type == 'comment') { + $node = node_load($object->nid); + $widgets = rate_get_active_widgets('comment', $node->type); + foreach ($widgets as $widget_id => $widget) { + $widget_name = 'rate_' . $widget->name; + $widget_code = rate_generate_widget($widget_id, 'comment', $object->cid); + if ($widget->comment_display == RATE_DISPLAY_LINKS) { + $links[$widget_name] = array( + 'title' => $widget_code, + 'html' => TRUE, + ); + } + } + } + + return $links; +} + +/** * AHAH callback for the vote buttons. */ function rate_vote_ahah() {