You are here

function rate_comment_view_alter in Rate 7

Implements hook_comment_view_alter().

File

./rate.module, line 808
Rate module

Code

function rate_comment_view_alter(&$comment) {
  $node = $comment['#node'];
  $widgets = rate_get_active_widgets('comment', $node->type);
  foreach ($widgets as $widget_id => $widget) {
    $widget_name = 'rate_' . $widget->name;
    $widget_code = array(
      '#weight' => $widget->comment_display == RATE_DISPLAY_ABOVE_CONTENT ? -50 : 50,
      '#markup' => rate_generate_widget($widget_id, 'comment', $comment['#comment']->cid, $widget->comment_display_mode),
    );
    if ($widget->comment_display == RATE_DISPLAY_DISABLE) {
      $comment['#' . $widget_name] = $widget_code;
    }
    else {
      $comment[$widget_name] = $widget_code;
    }
  }
}