You are here

public function SmsSettingsForm::submitForm in SMS Framework 8

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/SmsSettingsForm.php, line 115

Class

SmsSettingsForm
Provides a form for SMS settings.

Namespace

Drupal\sms\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $sms_settings = $this
    ->config('sms.settings');
  $path_verify = $form_state
    ->getValue([
    'pages',
    'verify',
  ]);

  // Only rebuild routes if the path was changed.
  if ($path_verify != $sms_settings
    ->get('page.verify')) {
    $this->routeBuilder
      ->setRebuildNeeded();
  }
  $this
    ->config('sms.settings')
    ->set('fallback_gateway', $form_state
    ->getValue('fallback_gateway'))
    ->set('page.verify', $path_verify)
    ->save();
  drupal_set_message($this
    ->t('SMS settings saved.'));
}