You are here

function glossify_theme_comment_view in Glossify 6.3

Themes a single comment and related items.

Parameters

$comment: The comment object.

$node: The comment node.

$links: An associative array containing control links suitable for passing into theme_links(). These are generated by modules implementing hook_link() with $type='comment'. Typical examples are links for editing and deleting comments.

$visible: Switches between folded/unfolded view. If TRUE the comments are visible, if FALSE the comments are folded.

1 string reference to 'glossify_theme_comment_view'
glossify_theme_registry_alter in ./glossify.module
Implementation of hook_theme_registry_alter().

File

./glossify.module, line 1045

Code

function glossify_theme_comment_view($comment, $node, $links = array(), $visible = TRUE) {
  static $first_new = TRUE;
  $output = '';
  $comment->new = node_mark($comment->nid, $comment->timestamp);
  if ($first_new && $comment->new != MARK_READ) {

    // Assign the anchor only for the first new comment. This avoids duplicate
    // id attributes on a page.
    $first_new = FALSE;
    $output .= "<a id=\"new\"></a>\n";
  }
  $output .= "<a id=\"comment-{$comment->cid}\"></a>\n";
  $glossify_mode = variable_get('glossify_process_mode', GLOSSIFY_USE_FILTER);

  // Switch to folded/unfolded view of the comment
  if ($visible) {

    // check_markup will invoke filter on comment text for links and hovertip styles if in 'filter' mode.
    $comment->comment = check_markup($comment->comment, $comment->format, FALSE);

    // Comment API hook - will process comment text for links and hovertip styles if in 'non-filter' mode.
    comment_invoke_comment($comment, 'view');

    // Now generate hidden hovertip elements for any comment glossary matches.
    // Processing of the hovertip body text takes place in the theme_glossify_term function.
    if ($glossify_mode != GLOSSIFY_WITHOUT_FILTER_OMIT_COMMENTS) {
      _glossify_comment_hovertips($comment, $node);
    }
    $output .= theme('comment', $comment, $node, $links);
  }
  else {
    $output .= theme('comment_folded', $comment);
  }
  return $output;
}