I really like the icon format, but also wanted to have the term itself as a link too, to help with SEO. I decided I need a new link format, that would include the icon but also include the term in the link. I called the new format "Icon + Term" (or iconterm internally) and implemented it with three changes.

After line 409 of glossary.admin.inc add:

      'iconterm' => t('Icon + Term'),

Next, change line 13 of glossary.js to be two lines:

  var selected = $("input[@name=glossary_replace]:checked").val();
  if (selected == 'icon' || selected == 'iconterm') {

Finally, change glossary.module. Specifically, within _glossary_filter_process we need to add a new case within the switch ($replace_mode) block (I added it just about the default case):

        case 'iconterm':
          // Icon format, plus term link.
          $img = '<img src="'. base_path() . variable_get("glossary_icon_$format", 'glossary.gif') ."\" />";
          if ($link_style == 'none') {
            $ins_after .= $img;
          }
          else {
            $ins_before .= '<a class="glossary-term" href="'. url($linkto, array('fragment' => $fragment, 'absolute' => $absolute_link)) .'">';
            $ins_after = $img . '</a>';
          }
          break;
          

Comments

nancydru’s picture

Status: Active » Fixed

Committed on both branches.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.