You are here

public function ConfigImportForm::validateForm in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/config/src/Form/ConfigImportForm.php \Drupal\config\Form\ConfigImportForm::validateForm()

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/config/src/Form/ConfigImportForm.php, line 74
Contains \Drupal\config\Form\ConfigImportForm.

Class

ConfigImportForm
Defines the configuration import form.

Namespace

Drupal\config\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  $file_upload = $this
    ->getRequest()->files
    ->get('files[import_tarball]', NULL, TRUE);
  if ($file_upload && $file_upload
    ->isValid()) {
    $form_state
      ->setValue('import_tarball', $file_upload
      ->getRealPath());
  }
  else {
    $form_state
      ->setErrorByName('import_tarball', $this
      ->t('The file could not be uploaded.'));
  }
}