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

Public Member Functions

 afterExportCreated ($content, $filename)
 Will trigger after the export file is created.
 
 alterLibrarySemantics (&$semantics, $machineName, $majorVersion, $minorVersion)
 Makes it possible to alter the semantics, adding custom fields, etc.
 
 clearFilteredParameters ($library_ids)
 Will clear filtered params for all the content that uses the specified libraries.
 
 copyLibraryUsage ($contentId, $copyFromId, $contentMainId=NULL)
 Give an H5P the same library dependencies as a given H5P.
 
 deleteCachedAssets ($library_id)
 Locate hash keys for given library and delete them.
 
 deleteContentData ($contentId)
 Deletes content data.
 
 deleteLibrary ($library)
 Delete a library from database and file system.
 
 deleteLibraryDependencies ($libraryId)
 Delete all dependencies belonging to given library.
 
 deleteLibraryUsage ($contentId)
 Delete what libraries a content item is using.
 
 fetchExternalData ($url, $data=NULL, $blocking=TRUE, $stream=NULL, $fullData=FALSE, $headers=array(), $files=array(), $method='POST')
 Fetches a file from a remote server using HTTP GET.
 
 getAdminUrl ()
 Returns the URL to the library admin page.
 
 getContentHubMetadataCache ($lang='en')
 Get content hub metadata cache from db.
 
 getContentHubMetadataChecked ($lang='en')
 Get time of last content hub metadata check.
 
 getLibraryConfig ($libraries=NULL)
 Load config for libraries.
 
 getLibraryContentCount ()
 Get the amount of content items associated to a library return int.
 
 getLibraryFileUrl ($libraryFolderName, $fileName)
 Get URL to file in the specific library.
 
 getLibraryId ($machineName, $majorVersion=NULL, $minorVersion=NULL)
 Get id to an existing library.
 
 getLibraryStats ($type)
 Generates statistics from the event log per library.
 
 getLibraryUsage ($libraryId, $skipContent=FALSE)
 Get number of content/nodes using a library, and the number of dependencies to other libraries.
 
 getMessages ($type)
 Return messages.
 
 getNumAuthors ()
 Aggregate the current number of H5P authors.
 
 getNumContent ($libraryId, $skip=NULL)
 Get number of contents using library as main library.
 
 getNumNotFiltered ()
 Get number of contents that has to get their content dependencies rebuilt and parameters re-filtered.
 
 getOption ($name, $default=NULL)
 Get stored setting.
 
 getPlatformInfo ()
 Returns info for the current platform.
 
 getUploadedH5pFolderPath ()
 Get the Path to the last uploaded h5p.
 
 getUploadedH5pPath ()
 Get the path to the last uploaded h5p file.
 
 getWhitelist ($isLibrary, $defaultContentWhitelist, $defaultLibraryWhitelist)
 Get file extension whitelist.
 
 hasPermission ($permission, $id=NULL)
 Check if user has permissions to an action.
 
 insertContent ($content, $contentMainId=NULL)
 Insert new content.
 
 isContentSlugAvailable ($slug)
 Determines if content slug is used.
 
 isInDevMode ()
 Is H5P in development mode?
 
 isPatchedLibrary ($library)
 Is the library a patched version of an existing library?
 
 libraryHasUpgrade ($library)
 Checks if the given library has a higher version.
 
 loadAddons ()
 Load addon libraries.
 
 loadContent ($id)
 Load content.
 
 loadContentDependencies ($id, $type=NULL)
 Load dependencies for the given content of the given type.
 
 loadLibraries ()
 Get a list of the current installed libraries.
 
 loadLibrary ($machineName, $majorVersion, $minorVersion)
 Loads a library.
 
 loadLibrarySemantics ($machineName, $majorVersion, $minorVersion)
 Loads library semantics.
 
 lockDependencyStorage ()
 Start an atomic operation against the dependency storage.
 
 mayUpdateLibraries ()
 Is the current user allowed to update libraries?
 
 replaceContentHubMetadataCache ($metadata, $lang)
 Replace content hub metadata cache.
 
 replaceContentTypeCache ($contentTypeCache)
 Replaces existing content type cache with the one passed in.
 
 resetContentUserData ($contentId)
 Resets marked user data for the given content.
 
 saveCachedAssets ($key, $libraries)
 Stores hash keys for cached assets, aggregated JavaScripts and stylesheets, and connects it to libraries so that we know which cache file to delete when a library is updated.
 
 saveLibraryData (&$libraryData, $new=TRUE)
 Store data about a library.
 
 saveLibraryDependencies ($libraryId, $dependencies, $dependency_type)
 Save what libraries a library is depending on.
 
 saveLibraryUsage ($contentId, $librariesInUse)
 Saves what libraries the content uses.
 
 setContentHubMetadataChecked ($time, $lang='en')
 Set time of last content hub metadata check.
 
 setErrorMessage ($message, $code=NULL)
 Show the user an error message.
 
 setInfoMessage ($message)
 Show the user an information message.
 
 setLibraryTutorialUrl ($machineName, $tutorialUrl)
 Set the tutorial URL for a library.
 
 setOption ($name, $value)
 Stores the given setting.
 
 t ($message, $replacements=array())
 Translation function.
 
 unlockDependencyStorage ()
 Stops an atomic operation against the dependency storage.
 
 updateContent ($content, $contentMainId=NULL)
 Update old content.
 
 updateContentFields ($id, $fields)
 This will update selected fields on the given content.
 

Member Function Documentation

◆ afterExportCreated()

Moodle\H5PFrameworkInterface::afterExportCreated ( $content,
$filename )

Will trigger after the export file is created.

Implemented in core_h5p\framework.

◆ alterLibrarySemantics()

Moodle\H5PFrameworkInterface::alterLibrarySemantics ( & $semantics,
$machineName,
$majorVersion,
$minorVersion )

Makes it possible to alter the semantics, adding custom fields, etc.

Parameters
array$semanticsAssociative array representing the semantics
string$machineNameThe library's machine name
int$majorVersionThe library's major version
int$minorVersionThe library's minor version

Implemented in core_h5p\framework.

◆ clearFilteredParameters()

Moodle\H5PFrameworkInterface::clearFilteredParameters ( $library_ids)

Will clear filtered params for all the content that uses the specified libraries.

This means that the content dependencies will have to be rebuilt, and the parameters re-filtered.

Parameters
array$library_ids

Implemented in core_h5p\framework.

◆ copyLibraryUsage()

Moodle\H5PFrameworkInterface::copyLibraryUsage ( $contentId,
$copyFromId,
$contentMainId = NULL )

Give an H5P the same library dependencies as a given H5P.

Parameters
int$contentIdId identifying the content
int$copyFromIdId identifying the content to be copied
int$contentMainIdMain id for the content, typically used in frameworks That supports versions. (In this case the content id will typically be the version id, and the contentMainId will be the frameworks content id

Implemented in core_h5p\framework.

◆ deleteCachedAssets()

Moodle\H5PFrameworkInterface::deleteCachedAssets ( $library_id)

Locate hash keys for given library and delete them.

Used when cache file are deleted.

Parameters
int$library_idLibrary identifier
Return values
arrayList of hash keys removed

Implemented in core_h5p\framework.

◆ deleteContentData()

Moodle\H5PFrameworkInterface::deleteContentData ( $contentId)

Deletes content data.

Parameters
int$contentIdId identifying the content

Implemented in core_h5p\framework.

◆ deleteLibrary()

Moodle\H5PFrameworkInterface::deleteLibrary ( $library)

Delete a library from database and file system.

Parameters
stdClass$libraryLibrary object with id, name, major version and minor version.

Implemented in core_h5p\framework.

◆ deleteLibraryDependencies()

Moodle\H5PFrameworkInterface::deleteLibraryDependencies ( $libraryId)

Delete all dependencies belonging to given library.

Parameters
int$libraryIdLibrary identifier

Implemented in core_h5p\framework.

◆ deleteLibraryUsage()

Moodle\H5PFrameworkInterface::deleteLibraryUsage ( $contentId)

Delete what libraries a content item is using.

Parameters
int$contentIdContent Id of the content we'll be deleting library usage for

Implemented in core_h5p\framework.

◆ fetchExternalData()

Moodle\H5PFrameworkInterface::fetchExternalData ( $url,
$data = NULL,
$blocking = TRUE,
$stream = NULL,
$fullData = FALSE,
$headers = array(),
$files = array(),
$method = 'POST' )

Fetches a file from a remote server using HTTP GET.

Parameters
string$urlWhere you want to get or send data.
array$dataData to post to the URL.
bool$blockingSet to 'FALSE' to instantly time out (fire and forget).
string$streamPath to where the file should be saved.
bool$fullDataReturn additional response data such as headers and potentially other data
array$headersHeaders to send
array$filesFiles to send
string$method
Return values
string|arrayThe content (response body), or an array with data. NULL if something went wrong

Implemented in core_h5p\framework.

◆ getAdminUrl()

Moodle\H5PFrameworkInterface::getAdminUrl ( )

Returns the URL to the library admin page.

Return values
stringURL to admin page

Implemented in core_h5p\framework.

◆ getContentHubMetadataCache()

Moodle\H5PFrameworkInterface::getContentHubMetadataCache ( $lang = 'en')

Get content hub metadata cache from db.

Parameters
string$langLanguage code in ISO 639-1
Return values
JsonSerializableJson string

Implemented in core_h5p\framework.

◆ getContentHubMetadataChecked()

Moodle\H5PFrameworkInterface::getContentHubMetadataChecked ( $lang = 'en')

Get time of last content hub metadata check.

Parameters
string$langLanguage code iin ISO 639-1 format
Return values
string|nullTime in RFC7231 format

Implemented in core_h5p\framework.

◆ getLibraryConfig()

Moodle\H5PFrameworkInterface::getLibraryConfig ( $libraries = NULL)

Load config for libraries.

Parameters
array$libraries
Return values
array

Implemented in core_h5p\framework.

◆ getLibraryContentCount()

Moodle\H5PFrameworkInterface::getLibraryContentCount ( )

Get the amount of content items associated to a library return int.

Implemented in core_h5p\framework.

◆ getLibraryFileUrl()

Moodle\H5PFrameworkInterface::getLibraryFileUrl ( $libraryFolderName,
$fileName )

Get URL to file in the specific library.

Parameters
string$libraryFolderName
string$fileName
Return values
stringURL to file

Implemented in core_h5p\framework.

◆ getLibraryId()

Moodle\H5PFrameworkInterface::getLibraryId ( $machineName,
$majorVersion = NULL,
$minorVersion = NULL )

Get id to an existing library.

If version number is not specified, the newest version will be returned.

Parameters
string$machineNameThe librarys machine name
int$majorVersionOptional major version number for library
int$minorVersionOptional minor version number for library
Return values
intThe id of the specified library or FALSE

Implemented in core_h5p\framework.

◆ getLibraryStats()

Moodle\H5PFrameworkInterface::getLibraryStats ( $type)

Generates statistics from the event log per library.

Parameters
string$typeType of event to generate stats for
Return values
arrayNumber values indexed by library name and version

Implemented in core_h5p\framework.

◆ getLibraryUsage()

Moodle\H5PFrameworkInterface::getLibraryUsage ( $libraryId,
$skipContent = FALSE )

Get number of content/nodes using a library, and the number of dependencies to other libraries.

Parameters
int$libraryIdLibrary identifier
boolean$skipContentFlag to indicate if content usage should be skipped
Return values
arrayAssociative array containing:
  • content: Number of content using the library
  • libraries: Number of libraries depending on the library

Implemented in core_h5p\framework.

◆ getMessages()

Moodle\H5PFrameworkInterface::getMessages ( $type)

Return messages.

Parameters
string$type'info' or 'error'
Return values
string[]

Implemented in core_h5p\framework.

◆ getNumAuthors()

Moodle\H5PFrameworkInterface::getNumAuthors ( )

Aggregate the current number of H5P authors.

Return values
int

Implemented in core_h5p\framework.

◆ getNumContent()

Moodle\H5PFrameworkInterface::getNumContent ( $libraryId,
$skip = NULL )

Get number of contents using library as main library.

Parameters
int$libraryId
array$skip
Return values
int

Implemented in core_h5p\framework.

◆ getNumNotFiltered()

Moodle\H5PFrameworkInterface::getNumNotFiltered ( )

Get number of contents that has to get their content dependencies rebuilt and parameters re-filtered.

Return values
int

Implemented in core_h5p\framework.

◆ getOption()

Moodle\H5PFrameworkInterface::getOption ( $name,
$default = NULL )

Get stored setting.

Parameters
string$nameIdentifier for the setting
string$defaultOptional default value if settings is not set
Return values
mixedWhatever has been stored as the setting

Implemented in core_h5p\framework.

◆ getPlatformInfo()

Moodle\H5PFrameworkInterface::getPlatformInfo ( )

Returns info for the current platform.

Return values
arrayAn associative array containing:
  • name: The name of the platform, for instance "Wordpress"
  • version: The version of the platform, for instance "4.0"
  • h5pVersion: The version of the H5P plugin/module

Implemented in core_h5p\framework.

◆ getUploadedH5pFolderPath()

Moodle\H5PFrameworkInterface::getUploadedH5pFolderPath ( )

Get the Path to the last uploaded h5p.

Return values
stringPath to the folder where the last uploaded h5p for this session is located.

◆ getUploadedH5pPath()

Moodle\H5PFrameworkInterface::getUploadedH5pPath ( )

Get the path to the last uploaded h5p file.

Return values
stringPath to the last uploaded h5p

◆ getWhitelist()

Moodle\H5PFrameworkInterface::getWhitelist ( $isLibrary,
$defaultContentWhitelist,
$defaultLibraryWhitelist )

Get file extension whitelist.

The default extension list is part of h5p, but admins should be allowed to modify it

Parameters
boolean$isLibraryTRUE if this is the whitelist for a library. FALSE if it is the whitelist for the content folder we are getting
string$defaultContentWhitelistA string of file extensions separated by whitespace
string$defaultLibraryWhitelistA string of file extensions separated by whitespace

Implemented in core_h5p\framework.

◆ hasPermission()

Moodle\H5PFrameworkInterface::hasPermission ( $permission,
$id = NULL )

Check if user has permissions to an action.

@method hasPermission

Parameters
[H5PPermission]$permission Permission type, ref H5PPermission
[int]$id Id need by platform to determine permission
Return values
boolean

Implemented in core_h5p\framework.

◆ insertContent()

Moodle\H5PFrameworkInterface::insertContent ( $content,
$contentMainId = NULL )

Insert new content.

Parameters
array$contentAn associative array containing:
  • id: The content id
  • params: The content in json format
  • library: An associative array containing:
    • libraryId: The id of the main library for this content
int$contentMainIdMain id for the content if this is a system that supports versions

Implemented in core_h5p\framework.

◆ isContentSlugAvailable()

Moodle\H5PFrameworkInterface::isContentSlugAvailable ( $slug)

Determines if content slug is used.

Parameters
string$slug
Return values
boolean

Implemented in core_h5p\framework.

◆ isInDevMode()

Moodle\H5PFrameworkInterface::isInDevMode ( )

Is H5P in development mode?

Return values
booleanTRUE if H5P development mode is active FALSE otherwise

Implemented in core_h5p\framework.

◆ isPatchedLibrary()

Moodle\H5PFrameworkInterface::isPatchedLibrary ( $library)

Is the library a patched version of an existing library?

Parameters
object$libraryAn associative array containing:
  • machineName: The library machineName
  • majorVersion: The librarys majorVersion
  • minorVersion: The librarys minorVersion
  • patchVersion: The librarys patchVersion
Return values
booleanTRUE if the library is a patched version of an existing library FALSE otherwise

Implemented in core_h5p\framework.

◆ libraryHasUpgrade()

Moodle\H5PFrameworkInterface::libraryHasUpgrade ( $library)

Checks if the given library has a higher version.

Parameters
array$library
Return values
boolean

Implemented in core_h5p\framework.

◆ loadAddons()

Moodle\H5PFrameworkInterface::loadAddons ( )

Load addon libraries.

Return values
array

Implemented in core_h5p\framework.

◆ loadContent()

Moodle\H5PFrameworkInterface::loadContent ( $id)

Load content.

Parameters
int$idContent identifier
Return values
arrayAssociative array containing:
  • contentId: Identifier for the content
  • params: json content as string
  • embedType: csv of embed types
  • title: The contents title
  • language: Language code for the content
  • libraryId: Id for the main library
  • libraryName: The library machine name
  • libraryMajorVersion: The library's majorVersion
  • libraryMinorVersion: The library's minorVersion
  • libraryEmbedTypes: CSV of the main library's embed types
  • libraryFullscreen: 1 if fullscreen is supported. 0 otherwise.

Implemented in core_h5p\framework.

◆ loadContentDependencies()

Moodle\H5PFrameworkInterface::loadContentDependencies ( $id,
$type = NULL )

Load dependencies for the given content of the given type.

Parameters
int$idContent identifier
int$typeDependency types. Allowed values:
  • editor
  • preloaded
  • dynamic
Return values
arrayList of associative arrays containing:
  • libraryId: The id of the library if it is an existing library.
  • machineName: The library machineName
  • majorVersion: The library's majorVersion
  • minorVersion: The library's minorVersion
  • patchVersion: The library's patchVersion
  • preloadedJs(optional): comma separated string with js file paths
  • preloadedCss(optional): comma separated sting with css file paths
  • dropCss(optional): csv of machine names

Implemented in core_h5p\framework.

◆ loadLibraries()

Moodle\H5PFrameworkInterface::loadLibraries ( )

Get a list of the current installed libraries.

Return values
arrayAssociative array containing one entry per machine name. For each machineName there is a list of libraries(with different versions)

Implemented in core_h5p\framework.

◆ loadLibrary()

Moodle\H5PFrameworkInterface::loadLibrary ( $machineName,
$majorVersion,
$minorVersion )

Loads a library.

Parameters
string$machineNameThe library's machine name
int$majorVersionThe library's major version
int$minorVersionThe library's minor version
Return values
array|FALSEFALSE if the library does not exist. Otherwise an associative array containing:
  • libraryId: The id of the library if it is an existing library.
  • title: The library's name
  • machineName: The library machineName
  • majorVersion: The library's majorVersion
  • minorVersion: The library's minorVersion
  • patchVersion: The library's patchVersion
  • runnable: 1 if the library is a content type, 0 otherwise
  • fullscreen(optional): 1 if the library supports fullscreen, 0 otherwise
  • embedTypes(optional): list of supported embed types
  • preloadedJs(optional): comma separated string with js file paths
  • preloadedCss(optional): comma separated sting with css file paths
  • dropLibraryCss(optional): list of associative arrays containing:
    • machineName: machine name for the librarys that are to drop their css
  • semantics(optional): Json describing the content structure for the library
  • preloadedDependencies(optional): list of associative arrays containing:
    • machineName: Machine name for a library this library is depending on
    • majorVersion: Major version for a library this library is depending on
    • minorVersion: Minor for a library this library is depending on
  • dynamicDependencies(optional): list of associative arrays containing:
    • machineName: Machine name for a library this library is depending on
    • majorVersion: Major version for a library this library is depending on
    • minorVersion: Minor for a library this library is depending on
  • editorDependencies(optional): list of associative arrays containing:
    • machineName: Machine name for a library this library is depending on
    • majorVersion: Major version for a library this library is depending on
    • minorVersion: Minor for a library this library is depending on

Implemented in core_h5p\framework.

◆ loadLibrarySemantics()

Moodle\H5PFrameworkInterface::loadLibrarySemantics ( $machineName,
$majorVersion,
$minorVersion )

Loads library semantics.

Parameters
string$machineNameMachine name for the library
int$majorVersionThe library's major version
int$minorVersionThe library's minor version
Return values
stringThe library's semantics as json

Implemented in core_h5p\framework.

◆ lockDependencyStorage()

Moodle\H5PFrameworkInterface::lockDependencyStorage ( )

Start an atomic operation against the dependency storage.

Implemented in core_h5p\framework.

◆ mayUpdateLibraries()

Moodle\H5PFrameworkInterface::mayUpdateLibraries ( )

Is the current user allowed to update libraries?

Return values
booleanTRUE if the user is allowed to update libraries FALSE if the user is not allowed to update libraries

Implemented in core_h5p\framework.

◆ replaceContentHubMetadataCache()

Moodle\H5PFrameworkInterface::replaceContentHubMetadataCache ( $metadata,
$lang )

Replace content hub metadata cache.

Parameters
JsonSerializable$metadataMetadata as received from content hub
string$langLanguage in ISO 639-1
Return values
mixed

Implemented in core_h5p\framework.

◆ replaceContentTypeCache()

Moodle\H5PFrameworkInterface::replaceContentTypeCache ( $contentTypeCache)

Replaces existing content type cache with the one passed in.

Parameters
object$contentTypeCacheJson with an array called 'libraries' containing the new content type cache that should replace the old one.

Implemented in core_h5p\framework.

◆ resetContentUserData()

Moodle\H5PFrameworkInterface::resetContentUserData ( $contentId)

Resets marked user data for the given content.

Parameters
int$contentId

Implemented in core_h5p\framework.

◆ saveCachedAssets()

Moodle\H5PFrameworkInterface::saveCachedAssets ( $key,
$libraries )

Stores hash keys for cached assets, aggregated JavaScripts and stylesheets, and connects it to libraries so that we know which cache file to delete when a library is updated.

Parameters
string$keyHash key for the given libraries
array$librariesList of dependencies(libraries) used to create the key

Implemented in core_h5p\framework.

◆ saveLibraryData()

Moodle\H5PFrameworkInterface::saveLibraryData ( & $libraryData,
$new = TRUE )

Store data about a library.

Also fills in the libraryId in the libraryData object if the object is new

Parameters
object$libraryDataAssociative array containing:
  • libraryId: The id of the library if it is an existing library.
  • title: The library's name
  • machineName: The library machineName
  • majorVersion: The library's majorVersion
  • minorVersion: The library's minorVersion
  • patchVersion: The library's patchVersion
  • runnable: 1 if the library is a content type, 0 otherwise
  • metadataSettings: Associative array containing:
    • disable: 1 if the library should not support setting metadata (copyright etc)
    • disableExtraTitleField: 1 if the library don't need the extra title field
  • fullscreen(optional): 1 if the library supports fullscreen, 0 otherwise
  • embedTypes(optional): list of supported embed types
  • preloadedJs(optional): list of associative arrays containing:
    • path: path to a js file relative to the library root folder
  • preloadedCss(optional): list of associative arrays containing:
    • path: path to css file relative to the library root folder
  • dropLibraryCss(optional): list of associative arrays containing:
    • machineName: machine name for the librarys that are to drop their css
  • semantics(optional): Json describing the content structure for the library
  • language(optional): associative array containing:
    • languageCode: Translation in json format
bool$new
Return values

Implemented in core_h5p\framework.

◆ saveLibraryDependencies()

Moodle\H5PFrameworkInterface::saveLibraryDependencies ( $libraryId,
$dependencies,
$dependency_type )

Save what libraries a library is depending on.

Parameters
int$libraryIdLibrary Id for the library we're saving dependencies for
array$dependenciesList of dependencies as associative arrays containing:
  • machineName: The library machineName
  • majorVersion: The library's majorVersion
  • minorVersion: The library's minorVersion
string$dependency_typeWhat type of dependency this is, the following values are allowed:
  • editor
  • preloaded
  • dynamic

Implemented in core_h5p\framework.

◆ saveLibraryUsage()

Moodle\H5PFrameworkInterface::saveLibraryUsage ( $contentId,
$librariesInUse )

Saves what libraries the content uses.

Parameters
int$contentIdId identifying the content
array$librariesInUseList of libraries the content uses. Libraries consist of associative arrays with:
  • library: Associative array containing:
    • dropLibraryCss(optional): comma separated list of machineNames
    • machineName: Machine name for the library
    • libraryId: Id of the library
  • type: The dependency type. Allowed values:
    • editor
    • dynamic
    • preloaded

Implemented in core_h5p\framework.

◆ setContentHubMetadataChecked()

Moodle\H5PFrameworkInterface::setContentHubMetadataChecked ( $time,
$lang = 'en' )

Set time of last content hub metadata check.

Parameters
int | null$timeTime in RFC7231 format
string$langLanguage code iin ISO 639-1 format
Return values
boolTrue if successful

Implemented in core_h5p\framework.

◆ setErrorMessage()

Moodle\H5PFrameworkInterface::setErrorMessage ( $message,
$code = NULL )

Show the user an error message.

Parameters
string$messageThe error message
string$codeAn optional code

Implemented in core_h5p\framework.

◆ setInfoMessage()

Moodle\H5PFrameworkInterface::setInfoMessage ( $message)

Show the user an information message.

Parameters
string$messageThe error message

Implemented in core_h5p\framework.

◆ setLibraryTutorialUrl()

Moodle\H5PFrameworkInterface::setLibraryTutorialUrl ( $machineName,
$tutorialUrl )

Set the tutorial URL for a library.

All versions of the library is set

Parameters
string$machineName
string$tutorialUrl

Implemented in core_h5p\framework.

◆ setOption()

Moodle\H5PFrameworkInterface::setOption ( $name,
$value )

Stores the given setting.

For example when did we last check h5p.org for updates to our libraries.

Parameters
string$nameIdentifier for the setting
mixed$valueData Whatever we want to store as the setting

Implemented in core_h5p\framework.

◆ t()

Moodle\H5PFrameworkInterface::t ( $message,
$replacements = array() )

Translation function.

Parameters
string$messageThe english string to be translated.
array$replacementsAn associative array of replacements to make after translation. Incidences of any key in this array are replaced with the corresponding value. Based on the first character of the key, the value is escaped and/or themed:
  • !variable: inserted as is
  • @variable: escape plain text to HTML
  • variable: escape text and theme as a placeholder for user-submitted content
Return values
stringTranslated string Translated string

Implemented in core_h5p\framework.

◆ unlockDependencyStorage()

Moodle\H5PFrameworkInterface::unlockDependencyStorage ( )

Stops an atomic operation against the dependency storage.

Implemented in core_h5p\framework.

◆ updateContent()

Moodle\H5PFrameworkInterface::updateContent ( $content,
$contentMainId = NULL )

Update old content.

Parameters
array$contentAn associative array containing:
  • id: The content id
  • params: The content in json format
  • library: An associative array containing:
    • libraryId: The id of the main library for this content
int$contentMainIdMain id for the content if this is a system that supports versions

Implemented in core_h5p\framework.

◆ updateContentFields()

Moodle\H5PFrameworkInterface::updateContentFields ( $id,
$fields )

This will update selected fields on the given content.

Parameters
int$idContent identifier
array$fieldsContent fields, e.g. filtered or slug.

Implemented in core_h5p\framework.


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