src/Sulu/Bundle/SnippetBundle/Controller/LanguageController.php
public function cgetAction()
    {
        /** @var WebspaceManagerInterface $webspaceManager */
        $webspaceManager = $this->get('sulu_core.webspace.webspace_manager');

        $localizations = [];
        $locales = [];

        /** @var Webspace $webspace */
        foreach ($webspaceManager->getWebspaceCollection() as $webspace) {
            $i = 0;
            foreach ($webspace->getAllLocalizations() as $localization) {
                if (!in_array($localization->getLocale(), $locales)) {
                    $locales[] = $localization->getLocale();
                    $localizations[] = [
                        'localization' => $localization->getLocale(),
                        'name' => $localization->getLocale(Localization::DASH),
                        'id' => $i++,
                    ];
                }
            }
        }

        $data = [
            '_embedded' => $localizations,
            'total' => count($localizations),
        ];

        return new JsonResponse($data);
    }
public function cgetAction()
    {
        /** @var WebspaceManagerInterface $webspaceManager */
        $webspaceManager = $this->get('sulu_core.webspace.webspace_manager');

        $localizations = [];
        $locales = [];

        /** @var Webspace $webspace */
        foreach ($webspaceManager->getWebspaceCollection() as $webspace) {
            $i = 0;
            foreach ($webspace->getAllLocalizations() as $localization) {
                if (!in_array($localization->getLocale(), $locales)) {
                    $locales[] = $localization->getLocale();
                    $localizations[] = [
                        'localization' => $localization->getLocale(),
                        'name' => $localization->getLocale(Localization::DASH),
                        'id' => $i++,
                    ];
                }
            }
        }

        $data = [
            '_embedded' => $localizations,
            'total' => count($localizations),
        ];

        return new JsonResponse($data);
    }
public function cgetAction ( ) { /** @var WebspaceManagerInterface $webspaceManager */ $ webspaceManager = $ this -> get ( 'sulu_core.webspace.webspace_manager' ) ; $ localizations = [ ] ; $ locales = [ ] ; /** @var Webspace $webspace */ foreach ( $ webspaceManager -> getWebspaceCollection ( ) as $ webspace ) { $ i = 0 ; foreach ( $ webspace -> getAllLocalizations ( ) as $ localization ) { if ( ! in_array ( $ localization -> getLocale ( ) , $ locales ) ) { $ locales [ ] = $ localization -> getLocale ( ) ; $ localizations [ ] = [ 'localization' => $ localization -> getLocale ( ) , 'name' => $ localization -> getLocale ( Localization :: DASH ) , 'id' => $ i ++ , ] ; } } } $ data = [ '_embedded' => $ localizations , 'total' => count ( $ localizations ) , ] ; return new JsonResponse ( $ data ) ; }
Returns all languages in admin.

@return JsonResponse
Returns all languages in admin .