Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
Moodle\H5peditor Class Reference

Public Member Functions

 __construct ($h5p, $storage, $ajaxInterface)
 
 addPresaveFile (&$assets, $library, $prefix='')
 Adds the path to the presave.js file to the list of dependency assets for the library.
 
 canInstallContentType ($contentType)
 
 findEditorLibraries ($machineName, $majorVersion, $minorVersion)
 Return all libraries used by the given editor library.
 
 getCachedLibsMap ($cached_library)
 Extract library properties from cached library so they are ready to be returned as JSON.
 
 getLatestGlobalLibrariesData ()
 Gets local and external libraries data with metadata to display all libraries that are currently available for the user.
 
 getLibraries ()
 Get list of libraries.
 
 getLibraryData ($machineName, $majorVersion, $minorVersion, $languageCode, $prefix='', $fileDir='', $defaultLanguage='')
 Get all scripts, css and semantics data for a library.
 
 getLibraryLanguage ($machineName, $majorVersion, $minorVersion, $languageCode)
 TODO: Consider moving to core.
 
 getTranslations ($libraries, $language_code)
 Get translations for a language for a list of libraries.
 
 getUserSpecificContentTypeCache ()
 Gets content type cache, applies user specific properties and formats as camelCase.
 
 hasPresave ($libraryName)
 Determine if a library has a presave.js file in the root folder.
 
 mergeLocalLibsIntoCachedLibs ($local_libraries, &$cached_libraries)
 Merge local libraries into cached libraries so that local libraries will get supplemented with the additional info from externally cached libraries.
 
 processParameters ($content, $newLibrary, $newParameters, $oldLibrary=NULL, $oldParameters=NULL)
 Move uploaded files, remove old files and update library usage.
 

Static Public Member Functions

static buildCssPath ($matches, $base=NULL)
 This function will prefix all paths within a CSS file.
 

Public Attributes

 $ajax
 
 $ajaxInterface
 
 $content
 

Static Public Attributes

static $scripts
 
static $styles
 

Member Function Documentation

◆ addPresaveFile()

Moodle\H5peditor::addPresaveFile ( & $assets,
$library,
$prefix = '' )

Adds the path to the presave.js file to the list of dependency assets for the library.

Parameters
array$assets
array$library
string$prefix

◆ buildCssPath()

static Moodle\H5peditor::buildCssPath ( $matches,
$base = NULL )
static

This function will prefix all paths within a CSS file.

Copied from Drupal 6.

@staticvar type $_base

Parameters
type$matches
type$base
Return values
type

◆ findEditorLibraries()

Moodle\H5peditor::findEditorLibraries ( $machineName,
$majorVersion,
$minorVersion )

Return all libraries used by the given editor library.

Parameters
string$machineNameLibrary identfier part 1
int$majorVersionLibrary identfier part 2
int$minorVersionLibrary identfier part 3

◆ getCachedLibsMap()

Moodle\H5peditor::getCachedLibsMap ( $cached_library)

Extract library properties from cached library so they are ready to be returned as JSON.

Parameters
object$cached_libraryA single library from the content type cache
Return values
arrayA map containing the necessary properties for a cached library to send to the front-end

◆ getLatestGlobalLibrariesData()

Moodle\H5peditor::getLatestGlobalLibrariesData ( )

Gets local and external libraries data with metadata to display all libraries that are currently available for the user.

Return values
array\$librariesLatest local and external libraries data with user specific permissions

◆ getLibraries()

Moodle\H5peditor::getLibraries ( )

Get list of libraries.

Return values
array

◆ getLibraryData()

Moodle\H5peditor::getLibraryData ( $machineName,
$majorVersion,
$minorVersion,
$languageCode,
$prefix = '',
$fileDir = '',
$defaultLanguage = '' )

Get all scripts, css and semantics data for a library.

Parameters
string$machineNameLibrary name
int$majorVersion
int$minorVersion
string$prefixOptional part to add between URL and asset path
string$fileDirOptional file dir to read files from
Return values
arrayLibraries that was requested

◆ getTranslations()

Moodle\H5peditor::getTranslations ( $libraries,
$language_code )

Get translations for a language for a list of libraries.

Parameters
array$librariesAn array of libraries, in the form "<machineName> <majorVersion>.<minorVersion>
string$language_code
Return values
array

◆ getUserSpecificContentTypeCache()

Moodle\H5peditor::getUserSpecificContentTypeCache ( )

Gets content type cache, applies user specific properties and formats as camelCase.

Return values
array\$librariesCached libraries from the H5P Hub with user specific permission properties

◆ hasPresave()

Moodle\H5peditor::hasPresave ( $libraryName)

Determine if a library has a presave.js file in the root folder.

Parameters
string$libraryName
Return values
bool

◆ mergeLocalLibsIntoCachedLibs()

Moodle\H5peditor::mergeLocalLibsIntoCachedLibs ( $local_libraries,
& $cached_libraries )

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

Parameters
array$local_librariesLocally installed libraries
array$cached_librariesCached libraries from the H5P hub

◆ processParameters()

Moodle\H5peditor::processParameters ( $content,
$newLibrary,
$newParameters,
$oldLibrary = NULL,
$oldParameters = NULL )

Move uploaded files, remove old files and update library usage.

Parameters
stdClass$content
array$newLibrary
array$newParameters
array$oldLibrary
array$oldParameters

Member Data Documentation

◆ $styles

Moodle\H5peditor::$styles
static
Initial value:
= array(
'libs/darkroom.css',
'styles/css/h5p-hub-client.css',
'styles/css/fonts.css',
'styles/css/application.css',
'styles/css/libs/zebra_datepicker.min.css'
)

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