H5P Guides

Moodle Customization

Customizing H5P content can be a useful tool for tailoring the H5Ps to fit your site.

Theme overriding/hooks

The H5P Moodle plugin has the same abilities to alter H5Ps as the other platform integrations.The way to do this is through extending a theme in Moodle. The theme would then need to override the renderer of the H5P plugin.

A complete example of  overriding the renderer can be found in the H5PMods example theme.

The H5P renderer is defined in renderer.php. All functions in the renderer can be overriden by a theme. You can read more about overriding a plugin renderer in the Moodle documentation.

To add a script to an H5P you would typically:

  1. Add to or extend the theme you are currently using in Moodle
  2. Extend the H5P renderer so you are able to override its functions
  3. Implement the h5p_alter_scripts function so that it adds your script to the existing scripts
  4. Activate the theme through the Moodle interface
  5. Visit an existing H5P to make sure your script is run

For a complete example of a theme that uses all the available overriding functionality of Moodle you can see the H5PMods example theme.