bundle/Form/Type/InformationCollectionType.php
protected function getLanguageCode(ContentType $contentType)
    {
        $contentTypeLanguages = array_keys($contentType->getNames());

        foreach ($this->languages as $languageCode) {
            if (in_array($languageCode, $contentTypeLanguages, true)) {
                return $languageCode;
            }
        }

        return $contentType->mainLanguageCode;
    }
protected function getLanguageCode(ContentType $contentType)
    {
        $contentTypeLanguages = array_keys($contentType->getNames());

        foreach ($this->languages as $languageCode) {
            if (in_array($languageCode, $contentTypeLanguages, true)) {
                return $languageCode;
            }
        }

        return $contentType->mainLanguageCode;
    }
protected function getLanguageCode ( ContentType $ contentType ) { $ contentTypeLanguages = array_keys ( $ contentType -> getNames ( ) ) ; foreach ( $ this -> languages as $ languageCode ) { if ( in_array ( $ languageCode , $ contentTypeLanguages , true ) ) { return $ languageCode ; } } return $ contentType -> mainLanguageCode ; }
If ContentType language code is in languages array then use it, else use first available one.

@param ContentType $contentType

@return string
If ContentType language code is in languages array then use it else use first available one .