You are here

function theme_glossify_term in Glossify 6.3

Same name and namespace in other branches
  1. 5 glossify.module \theme_glossify_term()
  2. 6 glossify.module \theme_glossify_term()

Render a glossary term.

2 theme calls to theme_glossify_term()
glossify_nodeapi in ./glossify.module
Implementation of hook_nodeapi().
_glossify_comment_hovertips in ./glossify.module
Helper function to generate hovertips from comment matches.

File

./glossify.module, line 77

Code

function theme_glossify_term($target, $glossify_style) {

  // outputs proper div so hovertip will work
  if (is_numeric($target)) {
    $term = node_load($target);
  }
  elseif (drupal_lookup_path('source', $target)) {
    $exploded_path = explode('/', drupal_lookup_path('source', $target));
    $term = node_load($exploded_path[count($exploded_path) - 1]);
  }
  switch ($glossify_style) {
    case 'reference':
      $output = '<dt>' . check_plain($term->title) . '</dt>';
      $output .= '<dd>' . check_markup($term->body) . '</dd>';
      break;
    case 'hovertip':
    default:
      $output = '<div id="' . check_plain($term->title) . '" class="hovertip" style="display: none;">';

      // Output a DIV to make hovertip work.
      $output .= '<h1>' . check_plain($term->title) . '</h1>';

      // Process node's body here if not using standard filter approach.
      $glossify_mode = variable_get('glossify_process_mode', GLOSSIFY_USE_FILTER);
      if ($glossify_mode != GLOSSIFY_USE_FILTER) {
        $term->body = glossify_filter('process', 0, $term->format, $term->body);
      }
      $output .= '<p>' . check_markup($term->body) . '</p>';
      $output .= '</div>';
      break;
  }

  // endswitch glossify style
  return $output;
}