<p>Add this to your plugin/controller:</p>

<pre><code>if (!craft()-&gt;config-&gt;get('devMode'))
{
    craft()-&gt;templates-&gt;getTwig()-&gt;addExtension(new \Twig_Extension_Debug());
}
</code></pre>

<p><em>Thanks to the all-knowing Brandon Kelly, who posted the solution on Slack.</em></p>

CC BY-SA 3.0
2015-12-13T08:43:10.080Z
I'm trying to integrate this code in my custom plugin. Not sure where to put it - the constructor for Controller class doesn't work (neither does the main plugin class constructor). Can you specify a bit more how to make this work? (I'm using Craft 2.5.2754)
Jure Srpcic
CC BY-SA 3.0
2017-09-20T19:29:47.793Z
Same, I don't understand exactly where/how to add this code snippet in? I'm wondering if Craft has an update that makes this irrelevant now?
skplunkerin
CC BY-SA 3.0
2015-11-06T13:45:12.247Z
2015-11-06T13:45:12.247Z
Fred Carlsen
<p>Is there a way to make the dump() function available in my plugin templates when devMode is disabled?</p>

<plugin-development><templating><devmode>
Make dump() available when devMode is disabled
# Make dump() available when devMode is disabled

(Asked by: username_0 on 2015-11-06)

Is there a way to make the dump() function available in my plugin templates when devMode is disabled?

**Tags:** plugin-development, templating, devmode

---

## 1 answers

### Answer by username_0 on 2015-11-06. Score: 5 | Accepted answer

Add this to your plugin/controller:
if (!craft()->config->get('devMode'))
{
    craft()->templates->getTwig()->addExtension(new \Twig_Extension_Debug());
}

Thanks to the all-knowing Brandon Kelly, who posted the solution on Slack.

> **Comments:**
> **username_1**: I'm trying to integrate this code in my custom plugin. Not sure where to put it - the constructor for Controller class doesn't work (neither does the main plugin class constructor). Can you specify a bit more how to make this work? (I'm using Craft 2.5.2754)  
> **username_2**: Same, I don't understand exactly where/how to add this code snippet in? I'm wondering if Craft has an update that makes this irrelevant now?  

---

