You are here

function quote_node_view in Quote 7

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

Implements hook_node_view().

File

./quote.module, line 71
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_node_view($node, $view_mode) {
  if (user_access('post comments') && in_array($node->type, _quote_variable_get('node_types')) && $node->comment == COMMENT_NODE_OPEN && _quote_variable_get('node_link_display')) {
    $links['quote'] = array(
      'title' => t('Quote'),
      'href' => "comment/reply/{$node->nid}",
      'attributes' => array(
        'title' => t('Quote this post in your reply.'),
      ),
      'query' => array(
        'quote' => 1,
      ),
      'fragment' => 'comment-form',
    );
    $node->content['links']['comment']['#links']['quote'] = $links['quote'];
    if (empty($node->content['links']['comment']['#attributes']['class'])) {
      $node->content['links']['comment']['#attributes']['class'] = array(
        'links',
        'inline',
      );
    }
    else {
      $node->content['links']['comment']['#attributes']['class'] += array(
        'links',
        'inline',
      );
    }
  }
}