Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 310 and 400] [Versions 39 and 400] [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]

(no description)

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

Defines 1 class


Class: H5peditor  - X-Ref

__construct($h5p, $storage, $ajaxInterface)   X-Ref
Constructor for the core editor library.

param: H5PCore $h5p Instance of core
param: H5peditorStorage $storage Instance of h5peditor storage interface
param: H5PEditorAjaxInterface $ajaxInterface Instance of h5peditor ajax

getLibraries()   X-Ref
Get list of libraries.

return: array

getTranslations($libraries, $language_code)   X-Ref
Get translations for a language for a list of libraries

return: array
param: array $libraries An array of libraries, in the form "<machineName> <majorVersion>.<minorVersion>
param: string $language_code

processParameters($content, $newLibrary, $newParameters, $oldLibrary = NULL, $oldParameters = NULL)   X-Ref
Move uploaded files, remove old files and update library usage.

param: stdClass $content
param: array $newLibrary
param: array $newParameters
param: array $oldLibrary
param: array $oldParameters

processSemantics(&$files, $semantics, &$params)   X-Ref
Recursive function that moves the new files in to the h5p content folder and generates a list over the old files.
Also locates all the librares.

param: array $files
param: array $libraries
param: array $semantics
param: array $params

processField(&$field, &$params, &$files)   X-Ref
Process a single field.

param: object $field
param: mixed $params
param: array $files

processFile(&$params, &$files)   X-Ref

param: mixed $params
param: array $files

getLibraryLanguage($machineName, $majorVersion, $minorVersion, $languageCode)   X-Ref
TODO: Consider moving to core.


findEditorLibraries($machineName, $majorVersion, $minorVersion)   X-Ref
Return all libraries used by the given editor library.

param: string $machineName Library identfier part 1
param: int $majorVersion Library identfier part 2
param: int $minorVersion Library identfier part 3

getLibraryData($machineName, $majorVersion, $minorVersion, $languageCode, $prefix = '', $fileDir = '', $defaultLanguage = '')   X-Ref
Get all scripts, css and semantics data for a library

return: array Libraries that was requested
param: string $machineName Library name
param: int $majorVersion
param: int $minorVersion
param: string $prefix Optional part to add between URL and asset path
param: string $fileDir Optional file dir to read files from

buildCssPath($matches, $base = NULL)   X-Ref
This function will prefix all paths within a CSS file.
Copied from Drupal 6.

return: type
param: type $matches
param: type $base

getUserSpecificContentTypeCache()   X-Ref
Gets content type cache, applies user specific properties and formats
as camelCase.

return: array $libraries Cached libraries from the H5P Hub with user specific

canInstallContentType($contentType)   X-Ref
No description

getLatestGlobalLibrariesData()   X-Ref
Gets local and external libraries data with metadata to display
all libraries that are currently available for the user.

return: array $libraries Latest local and external libraries data with

getCachedLibsMap($cached_library)   X-Ref
Extract library properties from cached library so they are ready to be
returned as JSON

return: array A map containing the necessary properties for a cached
param: object $cached_library A single library from the content type cache

mergeLocalLibsIntoCachedLibs($local_libraries, &$cached_libraries)   X-Ref
Merge local libraries into cached libraries so that local libraries will
get supplemented with the additional info from externally cached libraries.

Also sets whether a given cached library is installed and up to date with
the locally installed libraries

param: array $local_libraries Locally installed libraries
param: array $cached_libraries Cached libraries from the H5P hub

hasPresave($libraryName)   X-Ref
Determine if a library has a presave.js file in the root folder

return: bool
param: string $libraryName

addPresaveFile(&$assets, $library, $prefix = '')   X-Ref
Adds the path to the presave.js file to the list of dependency assets for the library

param: array $assets
param: array $library
param: string $prefix