$default_langcode =
$this->
config('language.negotiation'
)->
get('selected_langcode'
);
if ($default_langcode == LanguageInterface::LANGCODE_SITE_DEFAULT
) { $default_langcode =
$this->languageManager->
getDefaultLanguage()->
getId();
} foreach ($languages as $langcode =>
$language) { $value =
$form_state->
getValue(['prefix',
$langcode]);
if ($value === ''
) { if (!
($default_langcode ==
$langcode) &&
$form_state->
getValue('language_negotiation_url_part'
) == LanguageNegotiationUrl::CONFIG_PATH_PREFIX
) { // Throw a form error if the prefix is blank for a non-default language,
// although it is required for selected negotiation type.
$form_state->
setErrorByName("prefix][
$langcode",
$this->
t('The prefix may only be left blank for the <a href=":url">selected detection fallback language.</a>',
[ ':url' => Url::
fromRoute('language.negotiation_selected'
)->
toString(),
]));
} } elseif (str_contains($value, '/'
)) { // Throw a form error if the string contains a slash,
// which would not work.
$form_state->
setErrorByName("prefix][
$langcode",
$this->
t('The prefix may not contain a slash.'
));
} elseif (isset($count[$value]) &&
$count[$value] > 1
) { // Throw a form error if there are two languages with the same
// domain/prefix.