Hint needed for extending from H5P.Question ContentType Developing
Submitted by Firejunkie on Wed, 04/14/2021 - 16:46
Forums:
Hi,
I hope someone can help me.
I created my Own ContentType( CT ) and I want it to be compatible with QuestionSet. I have fulfilled the "Question type contract " with my CT.
Whenever i try to use my CT with CuestionSet i get an error that question.addButton is not a function.In a Video from Oliver Tracke I found out, that my CT should extend from H5P.Question. I have no idea where to start. I looked in some other ContentTypes like True/False to find out how to do that, but i have no clue. I have to mention, that im not so familiar with JQuary.
Thank You for Your Help
Degrange
Wed, 04/14/2021 - 17:44
Permalink
Olivier Tacke suggested me to
Olivier Tacke suggested me to check this template, that might help you : https://github.com/h5p/h5p-boilerplate/tree/question-type
otacke
Wed, 04/14/2021 - 19:42
Permalink
Hi Firejunkie!It has nothing
Hi Firejunkie!
It has nothing to do with jQuery and it's not even the question type contract. Unfortunately, H5P.QuestionSet quietly assumes that all subcontent extends the H5P.Question class. Your content type will simply have to do that in order to inherit H5P.Question's functions that can then be called by H5P.QuestionSet.
As Degrange suggested, you could have a look at the boilerplate template. If you're not using JavaScript's class notation, then you should check https://github.com/h5p/h5p-true-false/blob/master/scripts/h5p-true-false.js#L487-L489 and https://github.com/h5p/h5p-true-false/blob/master/scripts/h5p-true-false.js#L41-L42 since you had a look at TrueFalse anyway.
Cheers,
Oliver
Firejunkie
Thu, 04/15/2021 - 08:14
Permalink
Thanks
Hi Degrance and Oliver,
thank you for helping! This Boilerplate will help me :). And I will check the lines you pointet out. Now I know what todo next.
Cheers,
Yannik