You are here

function word_link_comment_view in Word Link 7

Same name and namespace in other branches
  1. 8 word_link.module \word_link_comment_view()

Implements hook_comment_view().

File

./word_link.module, line 115
This module allows users to replace previously defined words to the links.

Code

function word_link_comment_view($comment, $view_mode, $langcode) {
  $types = variable_get('word_link_node_types', array());

  // Get node type.
  $node_type = str_replace("comment_node_", '', $comment->node_type);
  if (isset($types[$node_type]['fields']['comments'])) {
    $words = word_link_get_link();

    // Check CSS status.
    if (variable_get('word_link_css', 1)) {
      drupal_add_css(drupal_get_path('module', 'word_link') . '/css/word_link.css');
    }

    // Rewrite value.
    $value = $comment->content['comment_body'][0]['#markup'];
    $comment->content['comment_body'][0]['#markup'] = word_link_replace_text($words, $value);
  }
}