src/Sulu/Bundle/WebsiteBundle/EventListener/AppendAnalyticsListener.php
protected function generateAnalyticsContent(array $analyticsContent, Analytics $analytics)
    {
        foreach (array_keys(self::$positions) as $position) {
            $template = 'SuluWebsiteBundle:Analytics:' . $analytics->getType() . '/' . $position . '.html.twig';

            if (!$this->engine->exists($template)) {
                continue;
            }

            $content = $this->engine->render($template, ['analytics' => $analytics]);
            if (!$content) {
                continue;
            }

            if (!array_key_exists($position, $analyticsContent)) {
                $analyticsContent[$position] = '';
            }

            $analyticsContent[$position] .= $content;
        }

        return $analyticsContent;
    }
protected function generateAnalyticsContent(array $analyticsContent, Analytics $analytics)
    {
        foreach (array_keys(self::$positions) as $position) {
            $template = 'SuluWebsiteBundle:Analytics:' . $analytics->getType() . '/' . $position . '.html.twig';

            if (!$this->engine->exists($template)) {
                continue;
            }

            $content = $this->engine->render($template, ['analytics' => $analytics]);
            if (!$content) {
                continue;
            }

            if (!array_key_exists($position, $analyticsContent)) {
                $analyticsContent[$position] = '';
            }

            $analyticsContent[$position] .= $content;
        }

        return $analyticsContent;
    }
protected function generateAnalyticsContent ( array $ analyticsContent , Analytics $ analytics ) { foreach ( array_keys ( self :: $ positions ) as $ position ) { $ template = 'SuluWebsiteBundle:Analytics:' . $ analytics -> getType ( ) . '/' . $ position . '.html.twig' ; if ( ! $ this -> engine -> exists ( $ template ) ) { continue ; } $ content = $ this -> engine -> render ( $ template , [ 'analytics' => $ analytics ] ) ; if ( ! $ content ) { continue ; } if ( ! array_key_exists ( $ position , $ analyticsContent ) ) { $ analyticsContent [ $ position ] = '' ; } $ analyticsContent [ $ position ] .= $ content ; } return $ analyticsContent ; }
Generate content for each possible position.

@param array $analyticsContent
@param Analytics $analytics

@return array
Generate content for each possible position .