Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
Moodle\H5peditorStorage Interface Reference
Inheritance diagram for Moodle\H5peditorStorage:
core_h5p\editor_framework

Public Member Functions

 alterLibraryFiles (&$files, $libraries)
 Alter styles and scripts.
 
 getAvailableLanguages ($machineName, $majorVersion, $minorVersion)
 Load a list of available language codes from the database.
 
 getLanguage ($machineName, $majorVersion, $minorVersion, $language)
 Load language file(JSON) from database.
 
 getLibraries ($libraries=NULL)
 Decides which content types the editor should have.
 
 keepFile ($fileId)
 "Callback" for mark the given file as a permanent file.
 

Static Public Member Functions

static markFileForCleanup ($file, $content_id)
 Marks a file for later cleanup, useful when files are not instantly cleaned up.
 
static removeTemporarilySavedFiles ($filePath)
 Clean up temporary files.
 
static saveFileTemporarily ($data, $move_file)
 Saves a file or moves it temporarily.
 

Member Function Documentation

◆ alterLibraryFiles()

Moodle\H5peditorStorage::alterLibraryFiles ( & $files,
$libraries )

Alter styles and scripts.

Parameters
array$filesList of files as objects with path and version as properties
array$librariesList of libraries indexed by machineName with objects as values. The objects have majorVersion and minorVersion as properties.

Implemented in core_h5p\editor_framework.

◆ getAvailableLanguages()

Moodle\H5peditorStorage::getAvailableLanguages ( $machineName,
$majorVersion,
$minorVersion )

Load a list of available language codes from the database.

Parameters
string$machineNameThe machine readable name of the library(content type)
int$majorVersionMajor part of version number
int$minorVersionMinor part of version number
Return values
arrayList of possible language codes

Implemented in core_h5p\editor_framework.

◆ getLanguage()

Moodle\H5peditorStorage::getLanguage ( $machineName,
$majorVersion,
$minorVersion,
$language )

Load language file(JSON) from database.

This is used to translate the editor fields(title, description etc.)

Parameters
string$nameThe machine readable name of the library(content type)
int$majorMajor part of version number
int$minorMinor part of version number
string$langLanguage code
Return values
stringTranslation in JSON format

Implemented in core_h5p\editor_framework.

◆ getLibraries()

Moodle\H5peditorStorage::getLibraries ( $libraries = NULL)

Decides which content types the editor should have.

Two usecases:

  1. No input, will list all the available content types.
  2. Libraries supported are specified, load additional data and verify that the content types are available. Used by e.g. the Presentation Tool Editor that already knows which content types are supported in its slides.
Parameters
array$librariesList of library names + version to load info for
Return values
arrayList of all libraries loaded

Implemented in core_h5p\editor_framework.

◆ keepFile()

Moodle\H5peditorStorage::keepFile ( $fileId)

"Callback" for mark the given file as a permanent file.

Used when saving content that has new uploaded files.

Parameters
int$fileId

Implemented in core_h5p\editor_framework.

◆ markFileForCleanup()

static Moodle\H5peditorStorage::markFileForCleanup ( $file,
$content_id )
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.

Parameters
H5peditorFile
$content_id

Implemented in core_h5p\editor_framework.

◆ removeTemporarilySavedFiles()

static Moodle\H5peditorStorage::removeTemporarilySavedFiles ( $filePath)
static

Clean up temporary files.

Parameters
string$filePathPath to file or directory

Implemented in core_h5p\editor_framework.

◆ saveFileTemporarily()

static Moodle\H5peditorStorage::saveFileTemporarily ( $data,
$move_file )
static

Saves a file or moves it temporarily.

This is often necessary in order to validate and store uploaded or fetched H5Ps.

Parameters
string$dataUri of data that should be saved as a temporary file
boolean$move_fileCan be set to TRUE to move the data instead of saving it
Return values
bool|objectReturns false if saving failed or the path to the file if saving succeeded

Implemented in core_h5p\editor_framework.


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