Skip to main content
Version: 5.1

Language Form Field

The language form field type provides a drop down list of the installed languages for the Frontend or Backend. If the field has a saved value this is selected when the page is first loaded. If not, the default value (if any) is selected. The value saved is the language tag. For example, for English (United Kingdom) this will be en-GB.

  • type (mandatory) must be language.
  • name (mandatory) is the unique name of the field.
  • label (mandatory) (translatable) is the field html label.
  • client (mandatory) is the application whose installed languages will be listed. Use 'site' when you want to list the Frontend languages or 'administrator' when you want to list the Backend languages.
  • description (optional) (translatable) is the field description.
  • default (optional) (translatable) is the default value.

Implemented by: libraries/src/Form/Field/LanguageField.php

Example XML parameter definition

<field
name="mylanguage"
type="language"
client="site"
default="en-GB"
label="Select a language"
description=""
/>