function TranslationStatusForm::validateForm

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

Overrides FormBase::validateForm

File

core/modules/locale/src/Form/TranslationStatusForm.php, line 250

Class

TranslationStatusForm
Provides a translation status form.

Namespace

Drupal\locale\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
    // Check if a language has been selected. 'tableselect' doesn't.
    if (!array_filter($form_state->getValue('langcodes'))) {
        $form_state->setErrorByName('', $this->t('Select a language to update.'));
    }
}

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