src/Controller/DefaultController.php
public function getSupportedLanguages($currentID)
    {
        $environment  = $this->getEnvironment();
        $dataProvider = $environment->getDataProvider();

        // Check if current data provider supports multi language.
        if ($dataProvider instanceof MultiLanguageDataProviderInterface) {
            $supportedLanguages = $dataProvider->getLanguages($currentID);
        } else {
            $supportedLanguages = null;
        }

        // Check if we have some languages.
        if (null === $supportedLanguages) {
            return [];
        }

        $translator = $environment->getTranslator();

        // Make an array from the collection.
        $languages = [];
        foreach ($supportedLanguages as $value) {
            /** @var LanguageInformationInterface $value */
            $locale = $value->getLocale();

            $languages[$locale] = $translator->translate('LNG.' . $locale, 'languages');
        }

        return $languages;
    }
public function getSupportedLanguages($currentID)
    {
        $environment  = $this->getEnvironment();
        $dataProvider = $environment->getDataProvider();

        // Check if current data provider supports multi language.
        if ($dataProvider instanceof MultiLanguageDataProviderInterface) {
            $supportedLanguages = $dataProvider->getLanguages($currentID);
        } else {
            $supportedLanguages = null;
        }

        // Check if we have some languages.
        if (null === $supportedLanguages) {
            return [];
        }

        $translator = $environment->getTranslator();

        // Make an array from the collection.
        $languages = [];
        foreach ($supportedLanguages as $value) {
            /** @var LanguageInformationInterface $value */
            $locale = $value->getLocale();

            $languages[$locale] = $translator->translate('LNG.' . $locale, 'languages');
        }

        return $languages;
    }
public function getSupportedLanguages ( $ currentID ) { $ environment = $ this -> getEnvironment ( ) ; $ dataProvider = $ environment -> getDataProvider ( ) ; // Check if current data provider supports multi language. if ( $ dataProvider instanceof MultiLanguageDataProviderInterface ) { $ supportedLanguages = $ dataProvider -> getLanguages ( $ currentID ) ; } else { $ supportedLanguages = null ; } // Check if we have some languages. if ( null === $ supportedLanguages ) { return [ ] ; } $ translator = $ environment -> getTranslator ( ) ; // Make an array from the collection. $ languages = [ ] ; foreach ( $ supportedLanguages as $ value ) { /** @var LanguageInformationInterface $value */ $ locale = $ value -> getLocale ( ) ; $ languages [ $ locale ] = $ translator -> translate ( 'LNG.' . $ locale , 'languages' ) ; } return $ languages ; }
Return all supported languages from the default data data provider.

@param mixed $currentID The id of the item for which to retrieve the valid languages.

@return array
Return all supported languages from the default data data provider .