Help with using other libraries

Colin D's picture
Forums: 

Hi all,

I followed the 'using other libraries' tutorial and was successful in creating an H5P greeting card library incorporating the H5P.MultiChoice and H5P.Blanks libraries. However, the tutorial states that you can only incorporate libraries which are installed on your system, so how should I approach the task of creating a library that builds on existing libraries but is intended to be run on unknown WordPress installations? Can I bundle the dependencies inside my library file structure? If so, can anyone walk me through this? 

Thanks,

 

Colin

serettig's picture

The dependency on other libraries is specified in library.json file. You distribute your whole content type by creating a .h5p package that includes your library and all dependent libraries. Open any .h5p file in a zip viewer and you'll see how every h5p package includes all required libraries. If you download/export content of you developed library in WordPress, Drupal or Moodle the package will automatically include the dependencies needed to use the library in another installation.

otacke's picture

Hi!

What Sebastian said. And you may want to use the H5P CLI tool to help you pack files. No need to manually build the libraries.

Cheers,
Oliver