Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
|
Moodle's implementation of the H5P Editor storage interface. More...
Public Member Functions | |
alterLibraryFiles (&$files, $libraries) | |
Allow for other plugins to decide which styles and scripts are attached. | |
getAvailableLanguages ($machinename, $major, $minor) | |
Load a list of available language codes. | |
getLanguage ($name, $major, $minor, $lang) | |
Load language file(JSON). | |
getLibraries ($libraries=null) | |
Return libraries details. | |
keepFile ($fileid) | |
"Callback" for mark the given file as a permanent file. | |
Static Public Member Functions | |
static | markFileForCleanup ($file, $contentid=null) |
Marks a file for later cleanup. | |
static | removeTemporarilySavedFiles ($filepath) |
Clean up temporary files. | |
static | saveFileTemporarily ($data, $movefile=false) |
Saves a file or moves it temporarily. | |
Moodle's implementation of the H5P Editor storage interface.
Makes it possible for the editor's core library to communicate with the database used by Moodle.
core_h5p\editor_framework::alterLibraryFiles | ( | & | $files, |
$libraries ) |
Allow for other plugins to decide which styles and scripts are attached.
This is useful for adding and/or modifying the functionality and look of the content types.
array | $files | List of files as objects with path and version as properties. |
array | $libraries | List of libraries indexed by machineName with objects as values. The objects have majorVersion and minorVersion as properties. |
Implements Moodle\H5peditorStorage.
core_h5p\editor_framework::getAvailableLanguages | ( | $machinename, | |
$major, | |||
$minor ) |
Load a list of available language codes.
Until translations is implemented, only returns the "en" language.
string | $machinename | The machine readable name of the library(content type) |
int | $major | Major part of version number |
int | $minor | Minor part of version number |
array | List of possible language codes |
Implements Moodle\H5peditorStorage.
core_h5p\editor_framework::getLanguage | ( | $name, | |
$major, | |||
$minor, | |||
$lang ) |
Load language file(JSON).
Used to translate the editor fields(title, description etc.)
string | $name | The machine readable name of the library(content type) |
int | $major | Major part of version number |
int | $minor | Minor part of version number |
string | $lang | Language code |
string|boolean | Translation in JSON format if available, false otherwise |
Implements Moodle\H5peditorStorage.
core_h5p\editor_framework::getLibraries | ( | $libraries = null | ) |
Return libraries details.
Two use cases:
array | $libraries | List of library names + version to load info for. |
array | List of all libraries loaded. |
Implements Moodle\H5peditorStorage.
core_h5p\editor_framework::keepFile | ( | $fileid | ) |
"Callback" for mark the given file as a permanent file.
Used when saving content that has new uploaded files.
int | $fileid |
Implements Moodle\H5peditorStorage.
|
static |
Marks a file for later cleanup.
Useful when files are not instantly cleaned up. E.g. for files that are uploaded through the editor.
int | $file | Id of file that should be cleaned up |
int | null | $contentid | Content id of file |
Implements Moodle\H5peditorStorage.
|
static |
Clean up temporary files.
string | $filepath | Path to file or directory |
Implements Moodle\H5peditorStorage.
|
static |
Saves a file or moves it temporarily.
This is often necessary in order to validate and store uploaded or fetched H5Ps.
string | $data | Uri of data that should be saved as a temporary file. |
bool | $movefile | Can be set to TRUE to move the data instead of saving it. |
bool|object | Returns false if saving failed or an object with path of the directory and file that is temporarily saved. |
Implements Moodle\H5peditorStorage.