H5P file management
Submitted by otacke on Thu, 02/02/2017 - 00:15
Forums:
I've been tampering with H5P's file management in h5p-php-editor-library, and it seems that information about media files consists of a path, a mime type and copyright information. Where's this structure defined? I managed to e.g. store additional information by adding fields to a file object inside h5peditor-av.js. I can see it inside the content.json file inside the H5P file that I can download. However it seems that this information isn't loaded or gets lost on its way back to the content type editor. Any hint will probably save me some time :-)
icc
Thu, 02/02/2017 - 09:28
Permalink
When you view H5P content for
When you view H5P content for the first time it's filtered against the fields defined in semantics. The image fields are validated using the H5PContentValidator class's validateImage() which really just adds a few allowed properties and let _validateFilelike() do the rest.
To allow for custom properties they have to be added by setting the "extraAttributes": ["myCustomProp"] property in semantics.json. Though, be aware that it doesn't look like the values entered for custom attributes are validated.
otacke
Thu, 02/02/2017 - 09:56
Permalink
It's really that easy? Maybe
It's really that easy? Maybe you could add this info to the semantics specification. Well, and I tend to validate and sanitize exessively anyway ...
otacke
Thu, 02/02/2017 - 21:30
Permalink
Hmm, I still didn't figure it
Hmm, I still didn't figure it out, I fear. I'll try again on Sunday when I have some more time.
otacke
Tue, 02/07/2017 - 22:00
Permalink
Had some time to sit down ...
Had some time to sit down ... It works. Thanks!