function _glossify_comment_hovertips in Glossify 6.3
Helper function to generate hovertips from comment matches.
1 call to _glossify_comment_hovertips()
- glossify_theme_comment_view in ./
glossify.module - Themes a single comment and related items.
File
- ./
glossify.module, line 1087
Code
function _glossify_comment_hovertips(&$comment, $node) {
$configurations = variable_get('glossify_configurations', array());
$referenced_terms = array();
foreach ($configurations as $config_name => $configuration) {
if (in_array($node->type, $configuration['from'])) {
$enabled_styles = array_filter($configuration['style']);
$possible_keywords = _fetch_possible_keywords($config_name, $configuration, $node->nid);
if (in_array('hovertip', $configuration['style']) && $configuration['style']['hovertip']) {
foreach ($possible_keywords as $kwd) {
list($term_title, $path) = $kwd;
if (in_array($term_title, $referenced_terms)) {
continue;
}
if (preg_match(_glossify_regex($configuration, $term_title), $comment->comment)) {
$referenced_terms[] = $term_title;
// Rough check that node does not already have a hovertip element for this term.
if (!isset($node->content['glossify_hovertip'][$term_title])) {
// Theming of comment hovertip will carry out glossify filter on the body
// if in non-filter mode, to allow hovertips to contain links to other glossary terms.
$comment->comment .= theme('glossify_term', $path, 'hovertip');
}
}
}
}
}
}
}