You are here

function _helper_node_add_unpublished_comments_link in Helper 7

Add the number of unpublished comments as a link on a node.

Parameters

object $node: A node object.

string $langcode: The language code to use when displaying the link.

1 call to _helper_node_add_unpublished_comments_link()
helper_node_view in ./helper.node.inc
Implements hook_node_view().

File

./helper.node.inc, line 43
Node hooks implemented by the Helper module.

Code

function _helper_node_add_unpublished_comments_link($node, $langcode) {
  if ($node->comment != COMMENT_NODE_HIDDEN && user_access('administer comments') && !empty($node->comment_unpublished_count)) {
    $node->content['links']['comment']['#links']['comment-unpublished-comments'] = array(
      'title' => format_plural($node->comment_unpublished_count, '1 unpublished comment', '@count unpublished comments', array(), array(
        'langcode' => $langcode,
      )),
      'href' => "node/{$node->nid}",
      'fragment' => 'comments',
    );
  }
}