How can I disable yii-debug-toolbar on a specific view?

Lonely picture Lonely · May 9, 2014 · Viewed 20.6k times · Source

How can I disable yii-debug-toolbar on a specific view especially on partial rendered views?

Is this possible?

p.s. Yii-debug-toolbar does unfortunately not exist as a tag below.

Answer

spikyjt picture spikyjt · Mar 6, 2015

Put this in your layout or view file:

if (class_exists('yii\debug\Module')) {
    $this->off(\yii\web\View::EVENT_END_BODY, [\yii\debug\Module::getInstance(), 'renderToolbar']);
}

This removes the callback that renders the toolbar from the event that runs at the end of the layout, where you have $this->endBody().