Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Static Public Member Functions | List of all members
core_h5p\player Class Reference

H5P player class, for displaying any local H5P content. More...

Public Member Functions

 __construct (string $url, stdClass $config, bool $preventredirect=true, string $component='')
 Inits the H5P player for rendering the content. More...
 
 add_assets_to_page ()
 Create the H5PIntegration variable that will be included in the page. More...
 
 get_context ()
 Get the context where the .h5p file belongs. More...
 
 get_export_file ()
 Return the info export file for Mobile App. More...
 
 get_messages ()
 Get the error messages stored in our H5P framework. More...
 
 get_title ()
 Get the title of the H5P content to display. More...
 
 output ()
 Outputs H5P wrapper HTML. More...
 

Static Public Member Functions

static display (string $url, stdClass $config, bool $preventredirect=true, string $component='')
 Get the encoded URL for embeding this H5P content. More...
 
static get_embed_url (string $url, string $component='')
 Get the encoded URL for embeding this H5P content. More...
 

Detailed Description

H5P player class, for displaying any local H5P content.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

core_h5p\player::__construct ( string  $url,
stdClass  $config,
bool  $preventredirect = true,
string  $component = '' 
)

Inits the H5P player for rendering the content.

Parameters
string$urlLocal URL of the H5P file to display.
stdClass$configConfiguration for H5P buttons.
bool$preventredirectSet to true in scripts that can not redirect (CLI, RSS feeds, etc.), throws exceptions
string$componentoptional moodle component to sent xAPI tracking

Member Function Documentation

◆ add_assets_to_page()

core_h5p\player::add_assets_to_page ( )

Create the H5PIntegration variable that will be included in the page.

This variable is used as the main H5P config variable.

◆ display()

static core_h5p\player::display ( string  $url,
stdClass  $config,
bool  $preventredirect = true,
string  $component = '' 
)
static

Get the encoded URL for embeding this H5P content.

Parameters
string$urlLocal URL of the H5P file to display.
stdClass$configConfiguration for H5P buttons.
bool$preventredirectSet to true in scripts that can not redirect (CLI, RSS feeds, etc.), throws exceptions
string$componentoptional moodle component to sent xAPI tracking
Return values
stringThe embedable code to display a H5P file.

◆ get_context()

core_h5p\player::get_context ( )

Get the context where the .h5p file belongs.

Return values
contextThe context.

◆ get_embed_url()

static core_h5p\player::get_embed_url ( string  $url,
string  $component = '' 
)
static

Get the encoded URL for embeding this H5P content.

Parameters
string$urlThe URL of the .h5p file.
string$componentoptional Moodle component to send xAPI tracking
Return values
moodle_urlThe embed URL.

◆ get_export_file()

core_h5p\player::get_export_file ( )

Return the info export file for Mobile App.

Return values
array

◆ get_messages()

core_h5p\player::get_messages ( )

Get the error messages stored in our H5P framework.

Return values
stdClasswith framework error messages.

◆ get_title()

core_h5p\player::get_title ( )

Get the title of the H5P content to display.

Return values
stringthe title

◆ output()

core_h5p\player::output ( )

Outputs H5P wrapper HTML.

Return values
stringThe HTML code to display this H5P content.

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