Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
YUI_config Class Reference

This class represents the YUI configuration. More...

Public Member Functions

 add_group ($name, $config)
 Create a new group within the YUI_config system.
 
 add_module_config ($name, $config, $group=null)
 Add configuration for a specific module.
 
 add_moodle_metadata ()
 Add the moodle YUI module metadata for the moodle group to the YUI_config instance.
 
 define_patched_core_modules ($combobase, $yuiversion, $patchlevel, $patchedmodules)
 Define YUI modules which we have been required to patch between releases.
 
 get_config_functions ()
 Retrieve the list of JavaScript functions for YUI_config groups.
 
 set_config_function ($function)
 Set the value of a configuration function used by the YUI Loader's pattern testing.
 
 set_config_source ($file)
 Allow setting of the config function described in {.
 
 update_group ($name, $config)
 Update an existing group configuration.
 
 update_header_js ($js)
 Update the header JavaScript with any required modification for the YUI Loader.
 

Public Attributes

 $base
 
 $combine
 
 $comboBase
 
 $debug = false
 These settings must be public so that when the object is converted to json they are exposed.
 
 $filter = null
 
 $groups = array()
 
 $insertBefore = 'firstthemesheet'
 
array $logExclude = []
 Tog sources that should be logged.
 
array $logInclude = []
 The log sources that should be not be logged.
 
string $logLevel
 The minimum log level for YUI logging statements.
 
 $modules = array()
 

Protected Attributes

array $jsconfigfunctions = array()
 List of functions used by the YUI Loader group pattern recognition.
 

Detailed Description

This class represents the YUI configuration.

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

Member Function Documentation

◆ add_group()

YUI_config::add_group ( $name,
$config )

Create a new group within the YUI_config system.

Parameters
string$nameThe name of the group. This must be unique and not previously used.
array$configThe configuration for this group.
Return values
void

◆ add_module_config()

YUI_config::add_module_config ( $name,
$config,
$group = null )

Add configuration for a specific module.

Parameters
string$nameThe name of the module to add configuration for.
array$configThe configuration for the specified module.
string$groupThe name of the group to add configuration for. If not specified, then this module is added to the global configuration.
Return values
void

◆ add_moodle_metadata()

YUI_config::add_moodle_metadata ( )

Add the moodle YUI module metadata for the moodle group to the YUI_config instance.

If js caching is disabled, metadata will not be served causing YUI to calculate module dependencies as each module is loaded.

If metadata does not exist it will be created and stored in a MUC entry.

Return values
void

◆ define_patched_core_modules()

YUI_config::define_patched_core_modules ( $combobase,
$yuiversion,
$patchlevel,
$patchedmodules )

Define YUI modules which we have been required to patch between releases.

We must do this because we aggressively cache content on the browser, and we must also override use of the external CDN which will serve the true authoritative copy of the code without our patches.

Parameters
string$combobaseThe local combobase
string$yuiversionThe current YUI version
int$patchlevelThe patch level we're working to for YUI
array$patchedmodulesAn array containing the names of the patched modules
Return values
void

◆ get_config_functions()

YUI_config::get_config_functions ( )

Retrieve the list of JavaScript functions for YUI_config groups.

Return values
stringThe complete set of config functions

◆ set_config_function()

YUI_config::set_config_function ( $function)

Set the value of a configuration function used by the YUI Loader's pattern testing.

Only the body of the function should be passed, and not the whole function wrapper.

The JS function your write will be passed a single argument 'name' containing the name of the module being loaded.

Parameters
$functionString the body of the JavaScript function. This should be used i
Return values
stringthe name of the function to use in the group pattern configuration.

◆ set_config_source()

YUI_config::set_config_source ( $file)

Allow setting of the config function described in {.

See also
set_config_function} from a file. The contents of this file are then passed to set_config_function.

When jsrev is positive, the function is minified and stored in a MUC cache for subsequent uses.

Parameters
$fileThe path to the JavaScript function used for YUI configuration.
Return values
stringthe name of the function to use in the group pattern configuration.

◆ update_group()

YUI_config::update_group ( $name,
$config )

Update an existing group configuration.

Note, any existing configuration for that group will be wiped out. This includes module configuration.

Parameters
string$nameThe name of the group. This must be unique and not previously used.
array$configThe configuration for this group.
Return values
void

◆ update_header_js()

YUI_config::update_header_js ( $js)

Update the header JavaScript with any required modification for the YUI Loader.

Parameters
$jsString The JavaScript to manipulate.
Return values
stringthe modified JS string.

Member Data Documentation

◆ $debug

YUI_config::$debug = false

These settings must be public so that when the object is converted to json they are exposed.

Note: Some of these are camelCase because YUI uses camelCase variable names.

The settings are described and documented in the YUI API at:


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