You are here

public function SettingsForm::submitForm in Slack 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/SettingsForm.php, line 104

Class

SettingsForm
Class SettingsForm.

Namespace

Drupal\slack\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->config('slack.settings');
  $config
    ->set('slack_webhook_url', trim($form_state
    ->getValue('slack_webhook_url')))
    ->set('slack_channel', $form_state
    ->getValue('slack_channel'))
    ->set('slack_username', $form_state
    ->getValue('slack_username'))
    ->set('slack_icon_type', $form_state
    ->getValue('slack_icon_type'))
    ->set('slack_icon_emoji', $form_state
    ->getValue('slack_icon_emoji'))
    ->set('slack_icon_url', $form_state
    ->getValue('slack_icon_url'))
    ->save();
  parent::submitForm($form, $form_state);
}