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

H5P editor class, for editing local H5P content. More...

Public Member Functions

 __construct ()
 Inits the H5P editor.
 
 add_editor_to_form (MoodleQuickForm $mform)
 Adds an H5P editor to a form.
 
 save_content (stdClass $content)
 Creates or updates an H5P content.
 
 set_content (int $id)
 Loads an existing content for edition.
 
 set_library (string $library, int $contextid, string $component, string $filearea, ?int $itemid=0, string $filepath='/', ?string $filename=null, ?int $userid=null)
 Sets the content type library and the file area to create a new H5P content.
 

Detailed Description

H5P editor class, for editing local H5P content.

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

Member Function Documentation

◆ add_editor_to_form()

core_h5p\editor::add_editor_to_form ( MoodleQuickForm $mform)

Adds an H5P editor to a form.

Parameters
MoodleQuickForm$mformMoodle Quick Form
Return values
void

◆ save_content()

core_h5p\editor::save_content ( stdClass $content)

Creates or updates an H5P content.

Parameters
stdClass$contentObject containing all the necessary data.
Return values
intContent id

◆ set_content()

core_h5p\editor::set_content ( int $id)

Loads an existing content for edition.

If the H5P content or its file can't be retrieved, it is not possible to edit the content.

Parameters
int$idId of the H5P content from the h5p table.
Return values
void

◆ set_library()

core_h5p\editor::set_library ( string $library,
int $contextid,
string $component,
string $filearea,
?int $itemid = 0,
string $filepath = '/',
?string $filename = null,
?int $userid = null )

Sets the content type library and the file area to create a new H5P content.

Note: this method must be used to create new content, to edit an existing H5P content use only set_content with the ID from the H5P table.

Parameters
string$libraryLibrary of the H5P content type to create.
int$contextidContext where the file of the H5P content will be stored.
string$componentComponent where the file of the H5P content will be stored.
string$fileareaFile area where the file of the H5P content will be stored.
int$itemidItem id file of the H5P content.
string$filepathFile path where the file of the H5P content will be stored.
null | string$filenameH5P content file name.
null | int$useridH5P content file owner userid (default will use $USER->id).
Return values
void

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