Onomasticon

Component ID

2826213

Component name

Onomasticon

Component type

module

Maintenance status

Development status

Component security advisory coverage

covered

Downloads

1211

Component created

Component changed

Component body

Onomasticon is a text filter to provide basic glossary functionality in Drupal 8 by using a designated vocabulary that contains all glossary terms.

Why YAG (Yet Another Glossary)?

There are quite a few glossary modules existing like Glossary, Lexicon, Glossify and G2. However, only Glossify and G2 provide a version for Drupal 8 (as of 2016-11-22), both being in dev status. Additionally, G2 requires PHP 5.6 which is good but may not yet apply to all site builders or clients. For Drupal 7, I mostly used Lexicon where I took some inspiration from for this module. I am open though for cooperation and even merging Onomasticon into a more experienced glossary module.

How to use?

  • Requirements: PHP extension mbstring must be enabled (it is not by default).
  • Download/install the module, out of the box nothing will change on your site.
  • Go to the settings of a text format of your choice from /admin/config/content/formats.
  • Enable Onomasticon Filter and scroll down to edit the filter's settings. The only mandatory setting is the vocabulary to use, all other settings have defaults built into the module.

Current features & options

  • Pure CSS solution in the frontend, no javascript used
  • Choose between tags dfn (default), abbr, and cite to be used
  • Choose implementation method
    1. add an extra element inside the tag to allow for HTML content being used in the term's description and have some fancy style - when this option is activated you may also choose if the tooltip should appear above or below the term1
    2. use the standard HTML title attribute - this will strip the description of all tags but it is more consistent across browsers, supports older browsers and is more search engine friendly
  • Choose a mouse cursor for hovering effect: no change (default text cursor), help cursor, or hide it on mouseover
  • Supports mixed cased usage of terms
  • Excludes text inside certain tags from replacement
  • Uses DOMDocument and only replaces text in #text nodes, thus all tag attributes throughout the whole document remain untouched

Footnote 1: The extra element used is a button element. I am aware of this being semantically incorrect to place a disabled button at this point, but the button element is the only one that can both (1) be used in a phrasing context and (2) contain HTML block elements. See my question regarding that issue on Stack Overflow.

Development status

This module was built for new Drupal 8 website which required a glossary function and there was no suitable and stable solution available. The development is ongoing and will mainly focus on the client's needs. But I am open for suggestions to improve the module beyond its original scope. If you can provide patches it will go even faster.

The development of this module has kindly been sponsored by the Ecologic Institute.