src/Sulu/Bundle/SnippetBundle/Twig/SnippetAreaTwigExtension.php
public function loadByArea($area, $webspaceKey = null, $locale = null)
    {
        if (!$webspaceKey) {
            $webspaceKey = $this->requestAnalyzer->getWebspace()->getKey();
        }
        if (!$locale) {
            $locale = $this->requestAnalyzer->getCurrentLocalization()->getLocale();
        }

        try {
            $snippet = $this->defaultSnippetManager->load($webspaceKey, $area, $locale);
        } catch (WrongSnippetTypeException $exception) {
            return null;
        } catch (DocumentNotFoundException $exception) {
            return null;
        }

        if (!$snippet) {
            return null;
        }

        $snippets = $this->snippetResolver->resolve([$snippet->getUuid()], $webspaceKey, $locale);

        if (!array_key_exists(0, $snippets)) {
            return null;
        }

        return $snippets[0];
    }
public function loadByArea($area, $webspaceKey = null, $locale = null)
    {
        if (!$webspaceKey) {
            $webspaceKey = $this->requestAnalyzer->getWebspace()->getKey();
        }
        if (!$locale) {
            $locale = $this->requestAnalyzer->getCurrentLocalization()->getLocale();
        }

        try {
            $snippet = $this->defaultSnippetManager->load($webspaceKey, $area, $locale);
        } catch (WrongSnippetTypeException $exception) {
            return null;
        } catch (DocumentNotFoundException $exception) {
            return null;
        }

        if (!$snippet) {
            return null;
        }

        $snippets = $this->snippetResolver->resolve([$snippet->getUuid()], $webspaceKey, $locale);

        if (!array_key_exists(0, $snippets)) {
            return null;
        }

        return $snippets[0];
    }
public function loadByArea ( $ area , $ webspaceKey = null , $ locale = null ) { if ( ! $ webspaceKey ) { $ webspaceKey = $ this -> requestAnalyzer -> getWebspace ( ) -> getKey ( ) ; } if ( ! $ locale ) { $ locale = $ this -> requestAnalyzer -> getCurrentLocalization ( ) -> getLocale ( ) ; } try { $ snippet = $ this -> defaultSnippetManager -> load ( $ webspaceKey , $ area , $ locale ) ; } catch ( WrongSnippetTypeException $ exception ) { return null ; } catch ( DocumentNotFoundException $ exception ) { return null ; } if ( ! $ snippet ) { return null ; } $ snippets = $ this -> snippetResolver -> resolve ( [ $ snippet -> getUuid ( ) ] , $ webspaceKey , $ locale ) ; if ( ! array_key_exists ( 0 , $ snippets ) ) { return null ; } return $ snippets [ 0 ] ; }
Load snippet for webspace by area.

@param string $area
@param string $webspaceKey
@param string $locale

@return array
Load snippet for webspace by area .