H5P validation errors

Forums: 

I'm having trouble trying to modify the course presentation module. The course designers on my team want to use image hotspot inside of course presentation. This is what I've done so far: pulled the code from github, updated the semantics.json, built the node project, and packed the h5p file.

But when the h5p is uploaded to my moodle site it returns the following validation errors:

  • A valid content folder is missing
  • A valid main h5p.json file is missing

I created an h5p.json file with all the mandatory properties, and the documentation says the content folder is optional. What is going wrong here?

Here's the h5p.json file:

{
  "title": "Course Presentation",
  "mainLibrary": "H5P.CoursePresentation",
  "language": "en",
  "embedTypes": ["iframe"],
  "preloadedDependencies": [
    {
      "machineName": "FontAwesome",
      "majorVersion": 4,
      "minorVersion": 5
    },
    {
      "machineName": "H5P.JoubelUI",
      "majorVersion": 1,
      "minorVersion": 3
    },
    {
      "machineName": "H5P.FontIcons",
      "majorVersion": 1,
      "minorVersion": 0
    }
  ]
}

 

Here's part of the semantics.json. All that's added is image hotspot to the list of options.

[
  {
    "name": "presentation",
    "type": "group",
    "importance": "high",
    "widget": "coursepresentation",
    "fields": [
      {
        "name": "slides",
        "importance": "high",
        "type": "list",
        "field": {
          "name": "slide",
          "importance": "high",
          "type": "group",
          "fields": [
            {
              "name": "elements",
              "importance": "high",
              "type": "list",
              "field": {
                "name": "element",
                "importance": "high",
                "type": "group",
                "fields": [
                  ...
                  {
                    "name": "action",
                    "type": "library",
                    "importance": "high",
                    "options": [
                      "H5P.AdvancedText 1.1",
                      "H5P.Link 1.3",
                      "H5P.Image 1.1",
                      "H5P.Shape 1.0",
                      "H5P.Video 1.5",
                      "H5P.Audio 1.4",
                      "H5P.Blanks 1.12",
                      "H5P.SingleChoiceSet 1.11",
                      "H5P.MultiChoice 1.14",
                      "H5P.TrueFalse 1.6",
                      "H5P.DragQuestion 1.13",
                      "H5P.Summary 1.10",
                      "H5P.DragText 1.8",
                      "H5P.MarkTheWords 1.9",
                      "H5P.Dialogcards 1.8",
                      "H5P.ContinuousText 1.2",
                      "H5P.ExportableTextArea 1.3",
                      "H5P.Table 1.1",
                      "H5P.InteractiveVideo 1.22",
                      "H5P.ImageHotspots 1.9", // <-- only added this
                      "H5P.TwitterUserFeed 1.0"
                    ],
...
otacke's picture

Are you uploading the H5P file (which obviously doesn't contain content) via the H5P Hub instead of uploading it via the H5P library settings page?

And things that you will run into next: Your site is probably not in development mode and will therefore simply ignore the library with the same version number, the Course Presentation editor will crash as it needs to preload the dependencies to content types that are supposed to be added, you will not see an icon in the menu bar and for the button mode as it needs to be added via CSS.

Thanks! Got it working!

Out of curiosity, how would I enable development mode in Moodle? I'm simply increasing the patch version right now.

Just found this in your previous reply. Thanks!

$CFG->mod_hvp_dev = true;
otacke's picture

Yup, that's how it is done. And anyone who wonders why bumping the version number to install custom patches is a very bad idea, please read my comment to https://peter.baumgartner.name/2021/04/12/h5p-library-installation/