function LocaleSettingsForm::validateForm

Same name and namespace in other branches
  1. 9 core/modules/locale/src/Form/LocaleSettingsForm.php \Drupal\locale\Form\LocaleSettingsForm::validateForm()
  2. 8.9.x core/modules/locale/src/Form/LocaleSettingsForm.php \Drupal\locale\Form\LocaleSettingsForm::validateForm()
  3. 11.x core/modules/locale/src/Form/LocaleSettingsForm.php \Drupal\locale\Form\LocaleSettingsForm::validateForm()

Overrides ConfigFormBase::validateForm

File

core/modules/locale/src/Form/LocaleSettingsForm.php, line 110

Class

LocaleSettingsForm
Configure locale settings for this site.

Namespace

Drupal\locale\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
    parent::validateForm($form, $form_state);
    if (empty($form['#translation_directory']) && $form_state->getValue('use_source') == LOCALE_TRANSLATION_USE_SOURCE_LOCAL) {
        $form_state->setErrorByName('use_source', $this->t('You have selected local translation source, but no <a href=":url">Interface translation directory</a> was configured.', [
            ':url' => Url::fromRoute('system.file_system_settings')->toString(),
        ]));
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.