Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 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] [Versions 39 and 311] [Versions 39 and 400] [Versions 39 and 401] [Versions 39 and 402] [Versions 39 and 403]

(no description)

File Size: 761 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

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

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

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
return: array Libraries that was requested

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

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

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

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

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

param: string $libraryName
return: bool

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