Module Description
Onomasticon is a text filter to provide basic glossary functionality in Drupal 8 by using a designated vocabulary that contains all glossary terms.
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
* 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
* 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
* You can exclude a specific instance of a word from being parsed by wrapping it in a (custom) tag and add that tag to the list of excluded tags. E.g. <NOnomasticon>non-interchangeable</NOnomasticon>
* Thanks to rattusrattus, there is now a CKEditor button available to quickly add the exclusion tag to a word. (Onomasticon 1.4+; this might work with Full HTML, only, due to CKEditor's Advanced Content Filter (ACF))
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.
Tips & tricks
* You can control the filter by sorting the terms in the selected vocabulary. For example, if the vocabulary contained "stone", and "stone wall" (ordered alphabetically), only "stone" would get a definition in the first appearance of "stone wall" due to the word boundary inside the term's name. If you move "stone wall" above "stone", the complete term will l get a tooltip. [credit to rattusrattus for finding that feature]
Development status
This module is seen as feature-complete - but I am open for suggestions to improve the module beyond its original scope. If you can provide patches it will go even faster.
As my current occupation doesn't leave me with enough spare time to work on my published modules, I am seeking co-maintainers that are willing to review patches and CR or even develop the module any further.
Why YAG (Yet Another Glossary)?
There were quite a few glossary modules existing for Drupal 7 like Glossary, Lexicon, Glossify and G2. Only Glossify and G2 provided a version for Drupal 8 (as of 2016-11-22), both being in dev status.
That's when Onomasticon started with ideas taken from Lexicon. More than four years later (January 2021), none of the mentioned modules offered a stable D8 nor a D9 compatible release.
However, since November 2021, there's a stable D8/D9 version of Glossify, since May 2023 it also supports Drupal 10. In June 2023, development of an updated version of G2 started, supporting D9 and D10.
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
* 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
* 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
* You can exclude a specific instance of a word from being parsed by wrapping it in a (custom) tag and add that tag to the list of excluded tags. E.g. <NOnomasticon>non-interchangeable</NOnomasticon>
* Thanks to rattusrattus, there is now a CKEditor button available to quickly add the exclusion tag to a word. (Onomasticon 1.4+; this might work with Full HTML, only, due to CKEditor's Advanced Content Filter (ACF))
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.
Tips & tricks
* You can control the filter by sorting the terms in the selected vocabulary. For example, if the vocabulary contained "stone", and "stone wall" (ordered alphabetically), only "stone" would get a definition in the first appearance of "stone wall" due to the word boundary inside the term's name. If you move "stone wall" above "stone", the complete term will l get a tooltip. [credit to rattusrattus for finding that feature]
Development status
This module is seen as feature-complete - but I am open for suggestions to improve the module beyond its original scope. If you can provide patches it will go even faster.
As my current occupation doesn't leave me with enough spare time to work on my published modules, I am seeking co-maintainers that are willing to review patches and CR or even develop the module any further.
Why YAG (Yet Another Glossary)?
There were quite a few glossary modules existing for Drupal 7 like Glossary, Lexicon, Glossify and G2. Only Glossify and G2 provided a version for Drupal 8 (as of 2016-11-22), both being in dev status.
That's when Onomasticon started with ideas taken from Lexicon. More than four years later (January 2021), none of the mentioned modules offered a stable D8 nor a D9 compatible release.
However, since November 2021, there's a stable D8/D9 version of Glossify, since May 2023 it also supports Drupal 10. In June 2023, development of an updated version of G2 started, supporting D9 and D10.
Module Link
Project Usage
220
Security Covered
Covered By Security Advisory
Version Available
Production
Module Summary
Onomasticon module aims to provide basic glossary functionality in Drupal 8 by using a designated vocabulary that contains all glossary terms.
Data Name
onomasticon