You are here

public function SettingsForm::submitForm in Replication 8.2

Same name and namespace in other branches
  1. 8 src/Form/SettingsForm.php \Drupal\replication\Form\SettingsForm::submitForm()

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 ConfigFormBase::submitForm

File

src/Form/SettingsForm.php, line 122

Class

SettingsForm
Class SettingsForm.

Namespace

Drupal\replication\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  parent::submitForm($form, $form_state);
  $config = $this
    ->config('replication.settings');
  $mapping_type = $form_state
    ->getValue('mapping_type');
  switch ($mapping_type) {
    case 'uid':
      $uid = $form_state
        ->getValue('uid');
      break;
    case 'anonymous':
      $uid = 0;
      break;
    case 'uid_1':
      $uid = 1;
      break;
    default:
      $uid = NULL;
  }
  $changes_limit = $form_state
    ->getValue('changes_limit');
  $bulk_docs_limit = $form_state
    ->getValue('bulk_docs_limit');
  $config
    ->set('mapping_type', $mapping_type)
    ->set('changes_limit', $changes_limit)
    ->set('bulk_docs_limit', $bulk_docs_limit)
    ->set('uid', trim($uid))
    ->save();
}