Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 39 and 310]

(no description)

File Size: 94 lines (3 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

H5peditorStorage:: (8 methods):
  getLanguage()
  getAvailableLanguages()
  keepFile()
  getLibraries()
  alterLibraryFiles()
  saveFileTemporarily()
  markFileForCleanup()
  removeTemporarilySavedFiles()


Interface: H5peditorStorage  - X-Ref

A defined interface for the editor to communicate with the database of the
web system.

getLanguage($machineName, $majorVersion, $minorVersion, $language)   X-Ref
Load language file(JSON) from database.
This is used to translate the editor fields(title, description etc.)

param: string $name The machine readable name of the library(content type)
param: int $major Major part of version number
param: int $minor Minor part of version number
param: string $lang Language code
return: string Translation in JSON format

getAvailableLanguages($machineName, $majorVersion, $minorVersion)   X-Ref
Load a list of available language codes from the database.

param: string $machineName The machine readable name of the library(content type)
param: int $majorVersion Major part of version number
param: int $minorVersion Minor part of version number
return: array List of possible language codes

keepFile($fileId)   X-Ref
"Callback" for mark the given file as a permanent file.
Used when saving content that has new uploaded files.

param: int $fileId

getLibraries($libraries = NULL)   X-Ref
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.

param: array $libraries List of library names + version to load info for
return: array List of all libraries loaded

alterLibraryFiles(&$files, $libraries)   X-Ref
Alter styles and scripts

param: array $files
param: array $libraries

saveFileTemporarily($data, $move_file)   X-Ref
Saves a file or moves it temporarily. This is often necessary in order to
validate and store uploaded or fetched H5Ps.

param: string $data Uri of data that should be saved as a temporary file
param: boolean $move_file Can be set to TRUE to move the data instead of saving it
return: bool|object Returns false if saving failed or the path to the file

markFileForCleanup($file, $content_id)   X-Ref
Marks a file for later cleanup, useful when files are not instantly cleaned
up. E.g. for files that are uploaded through the editor.

param: H5peditorFile
param: $content_id

removeTemporarilySavedFiles($filePath)   X-Ref
Clean up temporary files

param: string $filePath Path to file or directory