## Developers' Forum

### Adding to Twig Question Variable

Re: Adding to Twig Question Variable

Firstly, I assume you're just doing all this as an experimental way of understand the existing code, right? Because you certainly shouldn't ever alter the moodle base classes, such as questionbase, when developing plugin code.

There are a few other odd things going on in your code, but I'd rather not get lost in detail. Instead, here are some suggestions on how to debug code within Moodle.

2. An important tip inexplicably omitted from the above document is the function call debugging(message) which prints a traceback message to the web output, containing the given message parameter. [But note that debugging needs to be turned on, as explained in the above document.] To see the state of a particular variable at the time, such as the $question variable, use debugging(print_r($question, TRUE)). You can insert debugging calls at multiple points of interest in the code.