You are here

function hashtags_node_transform_to_links in Hashtags 6.2

Same name and namespace in other branches
  1. 7.2 hashtags.module \hashtags_node_transform_to_links()
1 call to hashtags_node_transform_to_links()
hashtags_nodeapi in ./hashtags.module
Implementation of hook_nodeapi().

File

./hashtags.module, line 96

Code

function hashtags_node_transform_to_links($text, $terms) {
  foreach ($terms as $word => $tid) {
    if (strstr($text, $word)) {
      $link = l($word, "taxonomy/term/{$tid}", array(
        'attributes' => array(
          'class' => 'hashtag',
        ),
      ));
      $text = str_replace($word, $link, $text);
    }
  }
  return $text;
}