protected function injectAlert(Response $response)
    {
        $content = $response->getContent();

        $pos = strripos($content, '<body>');
        if (false !== $pos) {
            $renderedContent = soda_cms_view('partials.draft-alert')->render();

            $content = substr($content, 0, $pos).$renderedContent.substr($content, $pos);

            // Update the new content and reset the content length
            $response->setContent($content);
            $response->headers->remove('Content-Length');
        }
    }
protected function injectAlert(Response $response)
    {
        $content = $response->getContent();

        $pos = strripos($content, '<body>');
        if (false !== $pos) {
            $renderedContent = soda_cms_view('partials.draft-alert')->render();

            $content = substr($content, 0, $pos).$renderedContent.substr($content, $pos);

            // Update the new content and reset the content length
            $response->setContent($content);
            $response->headers->remove('Content-Length');
        }
    }
protected function injectAlert ( Response $ response ) { $ content = $ response -> getContent ( ) ; $ pos = strripos ( $ content , '<body>' ) ; if ( false !== $ pos ) { $ renderedContent = soda_cms_view ( 'partials.draft-alert' ) -> render ( ) ; $ content = substr ( $ content , 0 , $ pos ) . $ renderedContent . substr ( $ content , $ pos ) ; // Update the new content and reset the content length $ response -> setContent ( $ content ) ; $ response -> headers -> remove ( 'Content-Length' ) ; } }
Injects the alertbar into the given Response.

@param Response $response A Response instance
Based on
https://github.com/symfony/WebProfilerBundle/blob/master/EventListener/WebDebugToolbarListener.php
Injects the alertbar into the given Response .