Load libaries dynamically
Hi all,
I use the content type H5P.Column several times in my content type H5P.RealityBox for structuring content.
These in turn can contain several different content types.
First of all it is not known from the beginning which content types are used in the columns.
Furthermore, not all available content types, especially those that are not used, should be loaded. This would be the case when using preloadedDependencies.
How can it be done that available libraries can be loaded dynamically, like it is the case in H5P.InteractiveVideo?
And how can they be included in the h5p package, so that the content can be used elsewhere?
Kind regards
Johannes
otacke
Sun, 04/25/2021 - 14:02
Permalink
Hi Johannes!Column already
Hi Johannes!
Column already loads libraries as needed. You will notice that this is done by putting them as library options in semantics.json, not into library.json.
There's already a ticket on the H5P Jira, AFAIR, that deals with modifying semantics options of subcontent, but I don't know about the priority of that ticket.
A workaround is to create a custom editor widget / multiple custom editor widgets that removes libraries from the options of H5P Column when used as subcontent, cmp. https://github.com/otacke/h5p-editor-accordion for https://github.com/h5p/h5p-accordion/pull/41
Best,
Oliver
jballmann
Sun, 04/25/2021 - 17:44
Permalink
Hi Oliver,in semantic.json
Hi Oliver,
in semantic.json under library options H5P.Column 1.13 is specified. With the help of H5PEditor and H5P.DragNBar.FormManager it is possible to load and edit a column in the editor.
When I save the content and try to create a column with H5P.newRunnable in H5P.RealityBox I get the following error:
Unable to find constructor for: H5P.Column 1.13
Uncaught TypeError: Cannot read property 'attach' of undefinedAnd accordingly then:
Kind regards
Johannes
otacke
Mon, 04/26/2021 - 09:28
Permalink
Sorry, I don't have the time
Sorry, I don't have the time to dig through code. Not sure why that library isn't loading.
jballmann
Wed, 04/28/2021 - 14:37
Permalink
*Solved*
Hi Oliver,
thanks for your help.
My h5p.classes.php had a mistake at one place.
I found it out while comparing it with the file available on Github.
Kind regards
Johannes
Kind regards
otacke
Wed, 04/28/2021 - 20:53
Permalink
Phew! Thanks for letting me
Phew! Thanks for letting me know. I might have had trouble finding that and would have gone grey over it ;-)