Moodle for mobile

Question type plugins for the 3.5 App

 
Picture of Dani Palou
Re: Question type plugins for the 3.5 App
Core developersMoodle HQParticularly helpful MoodlersPlugin developers

Hi Marcus,

sorry for the delay in answering, it's been some crazy months lately.

The process is the same as in the certificate example: create the mobile.php file, create a PHP function that returns a template/javascript/etc. and then create the template. The difference is that the certificate activity builds the template using PHP data because that template is downloaded when the user opens the activity (hence it has the cmid and courseid).

In question types your function is called as soon as the app is started, so there's no context, that's why you need to return a generic template. Instead of getting the data using PHP and use it to render the data, you need to return a "generic" template that will be built using JS data provided by the app. Your template will receive these inputs and outputs:

https://github.com/moodlehq/moodlemobile2/blob/v3.5.0/src/core/question/classes/base-question-component.ts#L25

Cheers,

Dani

 
Average of ratings: -