You are here

function quote_comment_view in Quote 7

Same name and namespace in other branches
  1. 7.2 quote.module \quote_comment_view()

Implements hook_comment_view().

File

./quote.module, line 94
The quote module provides a filter and appropriate links that allow users to quote nodes and other comments in their own comments.

Code

function quote_comment_view($comment) {
  if (user_access('post comments')) {
    $node = node_load($comment->nid);
    if (in_array($node->type, _quote_variable_get('node_types')) && $node->comment == COMMENT_NODE_OPEN) {
      $links['quote'] = array(
        'title' => t('quote'),
        'href' => "comment/reply/{$node->nid}/{$comment->cid}",
        'attributes' => array(
          'title' => t('Quote this post in your reply.'),
        ),
        'query' => array(
          'quote' => 1,
        ),
        'fragment' => 'comment-form',
      );
      $comment->content['links']['comment']['#links']['quote'] = $links['quote'];
      if (empty($comment->content['links']['comment']['#attributes']['class'])) {
        $comment->content['links']['comment']['#attributes']['class'] = array(
          'links',
          'inline',
        );
      }
      else {
        $comment->content['links']['comment']['#attributes']['class'] += array(
          'links',
          'inline',
        );
      }
    }
  }
}