Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
filter_multilang Class Reference

Implementation of the Moodle filter API for the Multi-lang filter. More...

Inheritance diagram for filter_multilang:
moodle_text_filter

Public Member Functions

 filter ($text, array $options=array())
 Override this function to actually implement the filtering. More...
 
 hash ()
 
 setup ($page, $context)
 Setup page with filter requirements and other prepare stuff. More...
 

Protected Member Functions

 get_parent_lang (string $lang)
 Puts some caching around get_parent_language(). More...
 
 process_match (array $langblock)
 This is the callback used by the preg_replace_callback call above. More...
 

Protected Attributes

context $context
 The context we are in.
 
array $localconfig
 Any local configuration for this filter in this context.
 

Detailed Description

Implementation of the Moodle filter API for the Multi-lang filter.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ filter()

filter_multilang::filter (   $text,
array  $options = array() 
)

Override this function to actually implement the filtering.

Parameters
string$textsome HTML content to process.
array$optionsoptions passed to the filters
Return values
stringthe HTML content after the filtering has been applied.

Reimplemented from moodle_text_filter.

◆ get_parent_lang()

filter_multilang::get_parent_lang ( string  $lang)
protected

Puts some caching around get_parent_language().

Also handle parent == 'en' in a way that works better for us.

Parameters
string$langa Moodle language code, e.g. 'fr'.
Return values
stringthe parent language.

◆ process_match()

filter_multilang::process_match ( array  $langblock)
protected

This is the callback used by the preg_replace_callback call above.

Parameters
array$langblockone of the matches from the regex match.
Return values
stringthe replacement string (one of the possible translations).

The documentation for this class was generated from the following file: