ImportForm::validateForm

public ImportForm::validateForm(array &$form, FormStateInterface $form_state)

Form validation handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormBase::validateForm

File

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

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('file', $form['file']['#upload_validators'], 'translations://', 0);

  // Ensure we have the file uploaded.
  if (!$this->file) {
    $form_state->setErrorByName('file', $this->t('File to import not found.'));
  }
}
doc_Drupal
2016-10-29 09:20:30
Comments
Leave a Comment

Please login to continue.