G2 Glossary should assign a CSS class to glossary links
pathscollide - April 1, 2007 - 10:01
| Project: | G2 Glossary |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | fgm |
| Status: | closed |
Jump to:
Description
As far as I can tell, using the markup, G2 does not assign a CSS class to links to glossary entries. This makes it impossible to define styles for these links.
Defining a different style for glossary links (e.g. dashed underline and "help" cursor) can be useful because it lets users know where they are going.

#1
Sorry, the dfn tag in my previous post got filtered out. I meant to say "the dfn markup."
#2
This is how I modified g2.module.
<?phpfunction _g2_filter_process($entry)
{
/* Create an associative array containing the desired class name and a title */
$definition_attributes['class'] = 'glossary-def-link';
$definition_attributes['title'] = 'Click to see definition';
$target = variable_get(G2VARREMOTEG2, G2DEFAULTREMOTEG2);
if ($target == G2DEFAULTREMOTENO) /* Then we are not using a remote glossary */
{
$target = G2PATHENTRIES;
}
// $ret = l($entry, G2PATHENTRIES ."/$entry");
$path = urlencode(_g2_terminal_encode($entry));
/* Pass the associative array created above to the l() function */
$ret = l($entry, "$target/$path", $definition_attributes, NULL, NULL, TRUE, FALSE);
return $ret;
}
?>
#3
There's something interesting in your suggestion. However:
$definition_attributes['title']should be set to somethingcontextually useful, not to something generic like . Possible
examples include: the number of definitions matching the DFN and their respective contexts,
or the beginning of the definition if only one definition matches the DFN
g2-dfn-link, instead ofglossary-def-link, to avoid namespace collision with what glossary.module can use, and to mention this is dfn-related, not def-relatedCould you prepare a patch addressing these points ? If successful, this could be a worthwile
addition to the module.
#4
Hi fgm,
Thanks for the tips. I will make the necessary changes in my code. However, sadly the patch and features you suggest are *way* beyond my abilities.
By the way, what do you mean by "the number of definitions matching the DFN"?
#5
A DFN can link to several definitions, because of homonyms. For instance, CSS can mean both "Content Scrambling System" or "Cascading Style Sheets", so the title of the A element generated from the DFN could mention the fact that there are 2 definitions for this initialism. Conversely, when only one definition exists, G2 could directly give the "expansion/definition" in the title of the A element.
Generating patches is not difficult: if you're on windows, use Tortoise CVS, just right click on the file you created and select Generate patch.
#6
Today's version (1.15.2.13) now includes the class g2-dfn-link on "a" links generated from
dfnelements by G2.The part about links formatting, being theme-specific, has been ignored.
#7
#8
Added to today's D5 version: bumping issue version.
#9
Automatically closed -- issue fixed for two weeks with no activity.
#10
Hi there,
I'm finally getting around to upgrading and it looks like this didn't make it into the Drupal 6 version of the module. Would it be possible to add it?
Thanks so much!
#11
Confirmed on 6.x. I'll add it.
#12
Fixed in today's HEAD, thanks.
#13
Thank you for the quick work on this!
#14
Automatically closed -- issue fixed for 2 weeks with no activity.