public static function LingotekLanguageForm::validateLocale in Lingotek Translation 8
Same name and namespace in other branches
- 8.2 src/Form/LingotekLanguageForm.php \Drupal\lingotek\Form\LingotekLanguageForm::validateLocale()
- 4.0.x src/Form/LingotekLanguageForm.php \Drupal\lingotek\Form\LingotekLanguageForm::validateLocale()
- 3.0.x src/Form/LingotekLanguageForm.php \Drupal\lingotek\Form\LingotekLanguageForm::validateLocale()
- 3.1.x src/Form/LingotekLanguageForm.php \Drupal\lingotek\Form\LingotekLanguageForm::validateLocale()
- 3.2.x src/Form/LingotekLanguageForm.php \Drupal\lingotek\Form\LingotekLanguageForm::validateLocale()
- 3.3.x src/Form/LingotekLanguageForm.php \Drupal\lingotek\Form\LingotekLanguageForm::validateLocale()
- 3.4.x src/Form/LingotekLanguageForm.php \Drupal\lingotek\Form\LingotekLanguageForm::validateLocale()
- 3.5.x src/Form/LingotekLanguageForm.php \Drupal\lingotek\Form\LingotekLanguageForm::validateLocale()
- 3.6.x src/Form/LingotekLanguageForm.php \Drupal\lingotek\Form\LingotekLanguageForm::validateLocale()
- 3.7.x src/Form/LingotekLanguageForm.php \Drupal\lingotek\Form\LingotekLanguageForm::validateLocale()
- 3.8.x src/Form/LingotekLanguageForm.php \Drupal\lingotek\Form\LingotekLanguageForm::validateLocale()
Validate the configurable language type form with lingotek options.
Parameters
array $form: The form definition array for the configurable language entity.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
See also
lingotek_form_language_admin_add_form_alter()
lingotek_form_language_admin_edit_form_alter()
File
- src/
Form/ LingotekLanguageForm.php, line 113
Class
- LingotekLanguageForm
- Alters the Drupal language module language forms.
Namespace
Drupal\lingotek\FormCode
public static function validateLocale(&$form, FormStateInterface $form_state) {
$form_key = [
'lingotek_locale',
];
if (!$form_state
->isValueEmpty($form_key)) {
$value = $form_state
->getValue($form_key);
if (!self::isValidLocale($value)) {
$form_state
->setErrorByName('lingotek_locale', t('The Lingotek locale %locale does not exist.', [
'%locale' => $value,
]));
}
}
}