Modifying the Embed Code
Submitted by roman on Thu, 01/12/2017 - 17:50
Forums:
Hi all, I am wondering if there is an easy way to modify the embed code that the H5P gives out in Drupal. If I could create a custom module to do that, it would be great.
I am asking because I would love to modify some parameters in the code as well as include a style tag to make sure that the presentation has a max width instead of becoming gigantic on a page due to the resize.js code.
Speaking of the js code I would also like to point it to a location that is not in the sites folder if possible.
Thanks for any input.
Roman
icc
Fri, 01/13/2017 - 11:36
Permalink
Hi Roman! Currently, the only
Hi Roman! Currently, the only way of changing this through another module is to have a hook that runs after h5p_preprocess_html that changes the inline JavaScript that's being added there.
I've noted that we should create an easier way of altering the H5P specific JS settings for other modules.
Regarding your last question, I'm not sure what you mean by pointing the js code to somewhere that's not in the sites folder?
roman
Fri, 01/13/2017 - 18:06
Permalink
Thanks for the reply. I'll
Thanks for the reply. I'll have to take a closer look at the JS that H5P is setting and see what can be done with that.
As far as my last question, what I mean was just changing the path of resize.js file. So lets say if something is preventing me on my end from having it in the library/js folder, I can make sure that the embed code that is provided to uses has a path that i put in there.
Thanks
icc
Mon, 01/16/2017 - 09:34
Permalink
If you are able to change the
If you are able to change the resize URL in the embed code it should be a small job to add a rewrite or alias to your web server that translates e.g. yourdomain.com/resize.js into sites/all/modules/h5p/library/resizer.js.