EasyAdmin Language Field
This field is used to represent the name of a language stored in a property as a valid ICU project language code (the same which is used by Symfony and many other tech projects).
In form pages (edit and new) it looks like this:
Basic Information
- PHP Class:
EasyCorp
\Bundle \EasyAdminBundle \Field \LanguageField - Doctrine DBAL Type used to store this value:
string
- Symfony Form Type used to render the field: LanguageType
Rendered as:
1
<select> ... </select>
Options
includeOnly
By default, the locale selector displays all the languages defined by the ICU project, the same which is used by Symfony and many other tech projects. Use this option to only display the given language codes:
1
yield LanguageField::new('...')->includeOnly(['en', 'fr', 'pl']);
remove
By default, the locale selector displays all the languages defined by the ICU project, the same which is used by Symfony and many other tech projects. Use this option to remove the given language codes from that list:
1
yield LanguageField::new('...')->remove(['fr', 'pl']);
showCode
By default, in read-only pages (index
and show
) this field displays the
full name of the language (e.g. Arabic
, Burmese
, Slovenian
, etc.)
Use this option if you want to display the language code (e.g. ar
, my
,
sl
, etc.) instead of or in addition to the language name:
1
yield LanguageField::new('...')->showCode();
showName
By default, in read-only pages (index
and show
) this field displays the
full name of the language (e.g. Arabic
, Burmese
, Slovenian
, etc.)
Use this option if you want to hide this name and display instead the language
code (e.g. ar
, my
, sl
, etc.):
1
yield LanguageField::new('...')->showName(false);
useAlpha3Codes
By default, the field expects that the given language code is a 2-letter value following the ISO 639-1 alpha-2 format. Use this option if you store the language code using the 3-letter value of the ISO 639-2 alpha-3 format:
1
yield LanguageField::new('...')->useAlpha3Codes();