You are here

public function ConfigPartialExportForm::submitForm in Config Partial Export 8

Form submission 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 FormInterface::submitForm

File

src/Form/ConfigPartialExportForm.php, line 186

Class

ConfigPartialExportForm
Construct the storage changes in a configuration synchronization form.

Namespace

Drupal\config_partial_export\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $user_input = $form_state
    ->getUserInput();
  $change_list = $user_input['change_list'] ?: [];
  $add_system_site_info = $user_input['addSystemSiteInfo'];
  $change_list_booleans = [];
  foreach ($change_list as $key => $value) {
    if ($value) {
      $change_list_booleans[$key] = TRUE;
    }
  }
  $last_selection = $this->state
    ->get('config_partial_export_form');
  $last_selection[$this
    ->currentUser()
    ->id()] = [
    'status_checkboxes_all' => $change_list_booleans,
    'status_checkbox_system' => (bool) $add_system_site_info,
  ];
  $this->state
    ->set('config_partial_export_form', $last_selection);
  $this
    ->createArchive(array_filter($change_list), $add_system_site_info);
  $form_state
    ->setRedirect('config_partial.export_partial_download');
}