Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

This filter provides automatic linking to glossary entries, aliases and categories when found inside every Moodle text.

Copyright: 2004 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 196 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

filter_glossary:: (5 methods):
  setup()
  get_all_concepts()
  filterobject_prepare_replacement_callback()
  filter()
  sort_entries_by_length()


Class: filter_glossary  - X-Ref

Glossary linking filter class.

NOTE: multilang glossary entries are not compatible with this filter.
setup($page, $context)   X-Ref
No description

get_all_concepts()   X-Ref
Get all the concepts for this context.

return: filterobject[] the concepts, and filterobjects.

filterobject_prepare_replacement_callback($concept, $glossaries)   X-Ref
Callback used by filterobject / filter_phrases.

param: object $concept the concept that is being replaced (from get_all_concepts).
param: array $glossaries the list of glossary titles (from get_all_concepts).
return: array [$hreftagbegin, $hreftagend, $replacementphrase] for filterobject.

filter($text, array $options = array()   X-Ref
No description

sort_entries_by_length($filterobject0, $filterobject1)   X-Ref
usort helper used in get_all_concepts above.

param: filterobject $filterobject0 first item to compare.
param: filterobject $filterobject1 second item to compare.
return: int -1, 0 or 1.