public static function renderDebugBar()
    {
        if (!self::$renderer) {
            return;
        }

        // Requirements may have been cleared (CMS iframes...) or not set (Security...)
        $js = Requirements::backend()->getJavascript();
        $debugBarResource = self::moduleResource('assets/debugbar.js');
        $path = $debugBarResource->getRelativePath();

        // Url in getJavascript has a / slash, so fix if necessary
        $path = str_replace("assets\\debugbar.js", "assets/debugbar.js", $path);
        if (!array_key_exists($path, $js)) {
            return;
        }
        $initialize = true;
        if (Director::is_ajax()) {
            $initialize = false;
        }

        $script = self::$renderer->render($initialize);
        return $script;
    }