Incomplete saving of my content type data
Hello all,
as part of my bachelor thesis I am working on the content type H5P.RealityBox.
It should make it possible to integrate 3D models into learning environments, which can also be viewed on VR headsets and Google Cardboard using WebXR.
The corresponding github repositories can be found here:
https://github.com/rwth-acis/h5p-realitybox
https://github.com/rwth-acis/h5p-babylonbox
https://github.com/rwth-acis/h5p-editor-realitybox
For the creation of the editor I followed the example of H5PEditor.InteractiveVideo.
The editor works so far, but I can't handle it to save the annotations that can be added to a model. All other things like the uploaded file and other additional information are saved.
I haven't noticed anything unusual during debugging: Right before sending, all options, including those of the annotations, are written into the hidden input field "json_content" and then sent to the server. But in the MySQL table the object was stored without the key "annotations".
Does anyone have an idea what this could be. All other content types, like Interactive Video can be saved without problems.
For the development I am using Drupal 7 together with the development folder.
Kind regards
jballmann
otacke
Thu, 04/15/2021 - 15:14
Permalink
Hi jballmann!As far as I can
Hi jballmann!
As far as I can see from a glimpse at your code, your editor widget is not calling the setValue callback function when you would want to inform the editor about value changes.
Best,
Oliver
jballmann
Thu, 04/15/2021 - 16:45
Permalink
Hi Oliver,thank you for your
Hi Oliver,
thank you for your quick response.
As it looks, the complete content is stored in the MySQL table in the column "json_content", but not in the column "filtered", which is used to call the constructor.
I have no idea where exactly is filtered by. But any content from H5PEditor.RealityBox is not there anymore.
Kind regards
Johannes
otacke
Thu, 04/15/2021 - 19:52
Permalink
Hi Johannes!The filtered
Hi Johannes!
The filtered column stores the result of processing and validating the json_content. Illegal values that are not meeting the specification for the particular field type (and empty arrays and empty objects AFAIR) will be removed, text may be HTML encoded, etc., cmp. https://h5p.org/semantics.
Best,
Oliver
jballmann
Sun, 04/18/2021 - 20:38
Permalink
Hi Oliver,I have checked my
Hi Oliver,
I have checked my semantics.json several times, but I can't find any error that could trigger this.
For the lists I didn't specify the mandatory fields label and entity, but this shouldn't be a problem because it wasn't done for Interactive Video either.
Here is an example for "json_content"
And this is what comes out when filtered
Is it possible to find out somewhere why something was filtered out e.g. by error message or log?
And is everything ignored if, in the object somewhere an error occurs or only all contents within the incorrect object?
Kind regards
Johannes
otacke
Fri, 04/16/2021 - 17:58
Permalink
Hi Johannes!I assume that
Hi Johannes!
I assume that filter function is in the H5PEditor core and passed its results to the plugin, but I don't know where exactly.
Best,
Oliver
otacke
Fri, 04/16/2021 - 18:03
Permalink
Out of curiosity I just had a
Out of curiosity I just had a quick look. I suppose that https://github.com/h5p/h5p-php-library/blob/master/h5p.classes.php#L2234 does the validation.
jballmann
Sun, 04/18/2021 - 20:37
Permalink
Hi Oliver,thanks for the hint
Hi Oliver,
thanks for the hint.
After logging every single validation function, I realized that you declare lists only with an array (without specifying the name).
I have modified H5PEditor.RealityBox accordingly.
Kind regards
Johannes
- - -
For explanation:
This is how json_content must look like:
Instead of: