Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.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.