You are here

public function AdminForm::submitForm in Evercurrent 8

Same name and namespace in other branches
  1. 8.2 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 134
Contains Drupal\evercurrent\Form\AdminForm.

Class

AdminForm
Class AdminForm.

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) {
    drupal_set_message('Attempting to contact server..');
    $updateHelper = \Drupal::service('evercurrent.update_helper');
    $result = $updateHelper
      ->sendUpdates(TRUE, NULL, TRUE);
  }
}