You are here

public function AdminForm::submitForm in Evercurrent 8.2

Same name and namespace in other branches
  1. 8 src/Form/AdminForm.php \Drupal\evercurrent\Form\AdminForm::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/AdminForm.php, line 121

Class

AdminForm
Administrative settings form.

Namespace

Drupal\evercurrent\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  parent::submitForm($form, $form_state);
  $this
    ->config('evercurrent.admin_config')
    ->set('send', $form_state
    ->getValue('send'))
    ->set('listen', $form_state
    ->getValue('listen'))
    ->set('target_address', $form_state
    ->getValue('target_address'))
    ->set('key', $form_state
    ->getValue('key'))
    ->set('interval', $form_state
    ->getValue('interval'))
    ->set('override', $form_state
    ->getValue('override'))
    ->save();
  if ($form_state
    ->getValue('send_now') == TRUE) {
    $this->messenger
      ->addMessage('Attempting to contact server.');
    $updateHelper = \Drupal::service('evercurrent.update_helper');
    $result = $updateHelper
      ->sendUpdates(TRUE, NULL, TRUE);
  }
}