Hi everybody!
How do I make an extension get attributes from different JSON files, like the Assessment extension?
In the example.json for Assessment extension it shows that you can put attributes in article.json, block.json and course.json. Which is very cool! ;)
How do I go about doing the same for my extension?
I have made an extension (called "Navicon") that appears at the bottom of every page and as such the JavaScript has these lines of code:
Adapt.on('pageView:postRender', function(view) {
if (view.model.has('_navicon')) {
new Navicon({
model: view.model
});
}
});
and thus the .json code it needs to function has to be added to the contentObjects.json.
Unless I have missed something the line:
Adapt.on('pageView:postRender', function(view) {
can be changed to something like:
Adapt.on('componentView:postRender', function(view) {
to make the extension appear on all components and take JSON attributes from components.json. This is in accordance with the names of the JavaScript files in the folder: src\core\js\views
But how do I make the extension listen to attributes from both contentObjects.json and course.json?
Any help will be much appreciated!
Thanks :)