public function ConfigImportForm::submitForm

Form submission handler.

Parameters

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

array $form_state: An associative array containing the current state of the form.

Overrides FormInterface::submitForm

File

drupal/core/modules/config/lib/Drupal/config/Form/ConfigImportForm.php, line 39

Class

ConfigImportForm

Namespace

Drupal\config\Form

Code

public function submitForm(array &$form, array &$form_state) {
  if ($path = $form_state['values']['import_tarball']) {
    \Drupal::service('config.storage.staging')
      ->deleteAll();
    $archiver = new ArchiveTar($path, 'gz');
    $files = array();
    foreach ($archiver
      ->listContent() as $file) {
      $files[] = $file['filename'];
    }
    $archiver
      ->extractList($files, config_get_config_directory(CONFIG_STAGING_DIRECTORY));
    drupal_unlink($path);
    drupal_set_message('Your configuration files were successfully uploaded, ready for import.');
    $form_state['redirect'] = 'admin/config/development/sync';
  }
}