You are here

public function LockrAdvancedForm::submitForm in Lockr 8.2

Same name and namespace in other branches
  1. 8.4 src/Form/LockrAdvancedForm.php \Drupal\lockr\Form\LockrAdvancedForm::submitForm()
  2. 8.3 src/Form/LockrAdvancedForm.php \Drupal\lockr\Form\LockrAdvancedForm::submitForm()
  3. 4.x src/Form/LockrAdvancedForm.php \Drupal\lockr\Form\LockrAdvancedForm::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 FormInterface::submitForm

File

src/Form/LockrAdvancedForm.php, line 124

Class

LockrAdvancedForm

Namespace

Drupal\lockr\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $custom = $form_state
    ->getValue('custom');
  $region = $form_state
    ->getValue('region');
  $this->state
    ->set('lockr.region', $region);
  $this->state
    ->set('lockr.custom', $custom);
  if ($custom) {
    $this->state
      ->setMultiple([
      'lockr.partner' => 'custom',
      'lockr.cert' => $form_state
        ->getValue('custom_cert'),
    ]);
  }
  else {
    $this->state
      ->deleteMultiple([
      'lockr.partner',
      'lockr.cert',
    ]);
  }
}