Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Static Public Member Functions | List of all members
core_requirejs Class Reference

Collection of requirejs related methods. More...

Static Public Member Functions

static find_all_amd_modules ($debug=false, $includelazy=false)
 Scan the source for AMD modules and return them all. More...
 
static find_one_amd_module ($component, $jsfilename, $debug=false)
 Check a single module exists and return the full path to it. More...
 

Detailed Description

Collection of requirejs related methods.

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

Member Function Documentation

◆ find_all_amd_modules()

static core_requirejs::find_all_amd_modules (   $debug = false,
  $includelazy = false 
)
static

Scan the source for AMD modules and return them all.

The expected location for amd modules is: <componentdir>/amd/src/modulename.js

Parameters
boolean$debugIf true, returns the paths to the original (unminified) source files.
boolean$includelazyIf true, includes modules with the -lazy suffix.
Return values
array::$filesAn array of mappings from module names to file paths.

◆ find_one_amd_module()

static core_requirejs::find_one_amd_module (   $component,
  $jsfilename,
  $debug = false 
)
static

Check a single module exists and return the full path to it.

The expected location for amd modules is: <componentdir>/amd/src/modulename.js

Parameters
string$componentThe component determines the folder the js file should be in.
string$jsfilenameThe filename for the module (with the js extension).
boolean$debugIf true, returns the paths to the original (unminified) source files.
Return values
array::$filesAn array of mappings from module names to file paths. Empty array if the file does not exist.

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