function ImportForm::validateForm

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

Overrides FormBase::validateForm

File

core/modules/locale/src/Form/ImportForm.php, line 161

Class

ImportForm
Form constructor for the translation import screen.

Namespace

Drupal\locale\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
    $this->file = _file_save_upload_from_form($form['file'], $form_state, 0);
    // Ensure we have the file uploaded.
    if (!$this->file) {
        $form_state->setErrorByName('file', $this->t('File to import not found.'));
    }
}

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