You are here

public function ConfigSplitActivateForm::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/ConfigSplitActivateForm.php, line 119

Class

ConfigSplitActivateForm
The form for activating 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
    ->singleActivate($split, $activate), $this->activeStorage);
  $this
    ->launchImport($comparer);
}