You are here

public function ConfigSplitImportForm::submitForm in Configuration Split 2.0.x

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/ConfigSplitImportForm.php, line 119

Class

ConfigSplitImportForm
The form for importing a split.

Namespace

Drupal\config_split\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $split = $this
    ->getSplit();
  $activate = !$split
    ->get('status');
  if ($activate) {
    if ($form_state
      ->getValue('activate_local_only')) {
      $this->statusOverride
        ->setSplitOverride($split
        ->getName(), TRUE);
      $activate = FALSE;
    }
    else {
      $this->statusOverride
        ->setSplitOverride($split
        ->getName(), NULL);
    }
  }
  $comparer = new StorageComparer($this->manager
    ->singleImport($split, $activate), $this->activeStorage);
  $this
    ->launchImport($comparer);
}