How to pass customized content types between platforms


Hello everyone!

I customized some content types on the drupal platform.

Now I want to know how to use these custom content types in moodle.

Can someone help me?

otacke's picture


The more sensitive thing first: You customized libraries. What does that mean? Did you just patch them? Did you do a clean fork? Do the moodle users know it's not the original version? I highly discourage from spreading customized H5P libraries that have not been forked properly. This is bound to mess with the others' system at some point.

Otherwise: That works the same way you'd share them on Drupal. Either you build and spread a library archive that you'd upload on the library setting page of moodle, or you create some sample content for download that will install the required libraries from the H5P file when uploading it via the H5P Hub (H5P plugin for moodle) or the H5P library settings page (moodle core version of H5P).


Thanks for reply!

Don't worry it's just for development things. When all it's done i'll do the merge request :)

So, i don't found in hvp mod folder, where to change the developed and builded files. 

As I understand it, I must compress the files using the h5p cli and just upload at the H5P library in the admin dashboard, right?




otacke's picture


The regular way to update or install H5P libraries is not by replacing or copying files, but by uploading libraries or content files to make sure that certain processes run and things are done. Shuffling files around may work if you just patch some things and then take care of H5P's cache, but it's likely that you will run into trouble at some point.

Installing by copying files will not work on moodle anyway, because moodle does not expose files directly but requires you to use its file API.

Yes, the usual way is to use H5P cli to build libraries or, as mentioned before, use sample content as an alternative.




I tried to upload the sample content from my project in moodle, but itsn't work. I attached a print screen 1 with the error message.

It seems have an invalid file inside of the folders. I tried to delete then and zip the project folders again and change .zip to .h5p extension. 

But another error message appear. I attached the print screen 2.

Do you know, what is going here?

otacke's picture

If you download files that draw distribution files from Drupal's development folder, H5P does not filter out files that are not valid (they wouldn't be in the libraries folder). That's why the files are there. H5P-CLI should have removed them.

If you zip files manually, you need to set some flags. There are a couple of threads on this topic on the forum already

The H5P CLI seems good, but itsn't packing all dependencies in development folder of drupal. I show you the steps bellow:

1. The librarys in develoment folder of drupal showed  in screen 1;

2. The h5p command to pack branching scneario and dependencies and the generated .h5p file after run h5p pack -r showed in screen 2;

3. The errors i received in moodle trying to upload the generated .h5p in screen 3;

So, i wanna know how to add these another dependencies in the generated .h5p from H5P CLI. I hope you underestanded.


otacke's picture

Hi edsamo!

H5P-CLI can only recursively pack what it finds in your working directory, here the development directory. If not all of those get used: Did you check the version numbers? Those are needed, of course. Are those directories git repositories? H5P-CLI most likely doesn't work on normal directories, so it's not enough to copy those from the libraries directory.


So, i think i'll do this manually. And yes, these folders are git repositories.

How can i zip manually? There is a zip cli for windows 10? Where can i download it?

The example bellow is from your comment in another post:

Required flags: -D (do not add directory entries) and -X (eXclude eXtra file attributes), e.g. as zip -rDX myNewFile.h5p *

What are the steps to pack manually?

Sorry for many questions XD

otacke's picture

Hi edsamo!

I don't know about Windows.


The zip command was avaible in my cmd. Don't know if it's native to windows of it's because I installed it in the past.


But I recommand you to use the CLI tool.

I managed to pack by linux, and this worked on moodle. Thanks!