function hashtags_node_transform_to_links in Hashtags 7.2
Same name and namespace in other branches
- 6.2 hashtags.module \hashtags_node_transform_to_links()
1 call to hashtags_node_transform_to_links()
- hashtags_node_load in ./
hashtags.module - Implementation of hook_node_load().
File
- ./
hashtags.module, line 225
Code
function hashtags_node_transform_to_links($text, $terms) {
foreach ($terms as $word => $tid) {
if (strstr($text, $word)) {
//$link = '<a href="#">'.$word.'</a>';// l($word, "taxonomy/term/$tid", array('attributes' => array('class' => 'hashtag')));
$link = l($word, "taxonomy/term/{$tid}");
// , array('attributes' => array('class' => 'hashtag'))
// TODO:
// Fatal error: [] operator not supported for strings in E:\xampp\htdocs\...\common.inc on line 2313
// $link = l($word, "taxonomy/term/$tid", array('attributes' => array('class' => 'hashtag'));
$pattern = "/{$word}\\b/";
$text = preg_replace($pattern, $link, $text);
}
}
return $text;
}