Pass data to modules

Forums: 

Hello everyone,

we are currently developing a prototype that will be using the interactive book as a parent and some other modules which will be used as elements in the interactive book.

The interactive book should be expanded with several submodules, like adapted Text, 3D View etc.

Additionally we also want to show some navigation element which should take data from the interactive book.
Right now, we are using DOM elements to get data from the book, which lacks of functionality. Until now, we did not manage to get data from the parent to the submodules. So the main question in this case would be:

Can we get pass data from the interactive book module (like chapters, chaptername, chapterIds, .... ) to the children?
So that for example we have this data in some param in a submodule?

Is such a functionality already given or can the interactive book extended at some point to do that?

Thanks in adavance for your help.
Patrick

 

otacke's picture

Hi Patrick!

Interactive Book uses Column to add content. You'd need to modify the contents' parameters within Interactive Book to suit your needs, pass that to Column (as the first argument of `newRunnable` in https://github.com/h5p/h5p-interactive-book/blob/1cbbe2906daa047a69785d3b822c1c91241e2196/src/scripts/pagecontent.js#L230) and from there it will find its way to the content type inside the chapter.

Cheers,
Oliver

Thanks Oliver,
this did the trick!

Patrick

otacke's picture

Glad I could help!