You are here

function theme_glossify_term in Glossify 6

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

Render a glossary term.

1 theme call to theme_glossify_term()
glossify_nodeapi in ./glossify.module
Implementation of hook_nodeapi().

File

./glossify.module, line 74

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>';
      $output .= '<p>' . check_markup($term->body) . '</p>';
      $output .= '</div>';
      break;
  }

  // endswitch glossify style
  return $output;
}