public static function includeRequirements()
    {
        $debugbar = self::getDebugBar();

        if (!$debugbar) {
            return;
        }

        // Already called
        if (self::$renderer) {
            return;
        }

        $renderer = $debugbar->getJavascriptRenderer();

        // We don't need the true path since we are going to use Requirements API that appends the BASE_PATH
        $assetsResource = self::moduleResource('assets');
        $renderer->setBasePath($assetsResource->getRelativePath());
        $renderer->setBaseUrl(Director::makeRelative($assetsResource->getURL()));

        $includeJquery = self::config()->get('include_jquery');
        // In CMS, jQuery is already included
        if (self::isAdminController()) {
            $includeJquery = false;
        }
        // If jQuery is already included, set to false
        $js = Requirements::backend()->getJavascript();
        foreach ($js as $url => $args) {
            $name = basename($url);
            if ($name == 'jquery.js' || $name == 'jquery.min.js') {
                $includeJquery = false;
                break;
            }
        }

        if ($includeJquery) {
            $renderer->setEnableJqueryNoConflict(true);
        } else {
            $renderer->disableVendor('jquery');
            $renderer->setEnableJqueryNoConflict(false);
        }

        if (DebugBar::config()->get('enable_storage')) {
            $renderer->setOpenHandlerUrl('__debugbar');
        }

        foreach ($renderer->getAssets('css') as $cssFile) {
            Requirements::css(Director::makeRelative(ltrim($cssFile, '/')));
        }

        foreach ($renderer->getAssets('js') as $jsFile) {
            Requirements::javascript(Director::makeRelative(ltrim($jsFile, '/')));
        }

        self::$renderer = $renderer;
    }
public static function includeRequirements()
    {
        $debugbar = self::getDebugBar();

        if (!$debugbar) {
            return;
        }

        // Already called
        if (self::$renderer) {
            return;
        }

        $renderer = $debugbar->getJavascriptRenderer();

        // We don't need the true path since we are going to use Requirements API that appends the BASE_PATH
        $assetsResource = self::moduleResource('assets');
        $renderer->setBasePath($assetsResource->getRelativePath());
        $renderer->setBaseUrl(Director::makeRelative($assetsResource->getURL()));

        $includeJquery = self::config()->get('include_jquery');
        // In CMS, jQuery is already included
        if (self::isAdminController()) {
            $includeJquery = false;
        }
        // If jQuery is already included, set to false
        $js = Requirements::backend()->getJavascript();
        foreach ($js as $url => $args) {
            $name = basename($url);
            if ($name == 'jquery.js' || $name == 'jquery.min.js') {
                $includeJquery = false;
                break;
            }
        }

        if ($includeJquery) {
            $renderer->setEnableJqueryNoConflict(true);
        } else {
            $renderer->disableVendor('jquery');
            $renderer->setEnableJqueryNoConflict(false);
        }

        if (DebugBar::config()->get('enable_storage')) {
            $renderer->setOpenHandlerUrl('__debugbar');
        }

        foreach ($renderer->getAssets('css') as $cssFile) {
            Requirements::css(Director::makeRelative(ltrim($cssFile, '/')));
        }

        foreach ($renderer->getAssets('js') as $jsFile) {
            Requirements::javascript(Director::makeRelative(ltrim($jsFile, '/')));
        }

        self::$renderer = $renderer;
    }
public static function includeRequirements ( ) { $ debugbar = self :: getDebugBar ( ) ; if ( ! $ debugbar ) { return ; } // Already called if ( self :: $ renderer ) { return ; } $ renderer = $ debugbar -> getJavascriptRenderer ( ) ; // We don't need the true path since we are going to use Requirements API that appends the BASE_PATH $ assetsResource = self :: moduleResource ( 'assets' ) ; $ renderer -> setBasePath ( $ assetsResource -> getRelativePath ( ) ) ; $ renderer -> setBaseUrl ( Director :: makeRelative ( $ assetsResource -> getURL ( ) ) ) ; $ includeJquery = self :: config ( ) -> get ( 'include_jquery' ) ; // In CMS, jQuery is already included if ( self :: isAdminController ( ) ) { $ includeJquery = false ; } // If jQuery is already included, set to false $ js = Requirements :: backend ( ) -> getJavascript ( ) ; foreach ( $ js as $ url => $ args ) { $ name = basename ( $ url ) ; if ( $ name == 'jquery.js' || $ name == 'jquery.min.js' ) { $ includeJquery = false ; break ; } } if ( $ includeJquery ) { $ renderer -> setEnableJqueryNoConflict ( true ) ; } else { $ renderer -> disableVendor ( 'jquery' ) ; $ renderer -> setEnableJqueryNoConflict ( false ) ; } if ( DebugBar :: config ( ) -> get ( 'enable_storage' ) ) { $ renderer -> setOpenHandlerUrl ( '__debugbar' ) ; } foreach ( $ renderer -> getAssets ( 'css' ) as $ cssFile ) { Requirements :: css ( Director :: makeRelative ( ltrim ( $ cssFile , '/' ) ) ) ; } foreach ( $ renderer -> getAssets ( 'js' ) as $ jsFile ) { Requirements :: javascript ( Director :: makeRelative ( ltrim ( $ jsFile , '/' ) ) ) ; } self :: $ renderer = $ renderer ; }
Include DebugBar assets using Requirements API

@return void
Include DebugBar assets using Requirements API