You are here

public function drupalchatSettingsForm::submitForm in DrupalChat 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/drupalchatSettingsForm.php, line 322
Contains Drupal\drupalchat\Form\drupalchatSettingsForm

Class

drupalchatSettingsForm
Class drupalchatSettingsForm

Namespace

Drupal\drupalchat\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  parent::submitForm($form, $form_state);

  // print_r($form_state->getValue('drupalchat_anon_prefix'));
  // exit;
  $this
    ->config('drupalchat.settings')
    ->set('drupalchat_polling_method', $form_state
    ->getValue('drupalchat_polling_method'))
    ->set('drupalchat_external_api_key', $form_state
    ->getValue('drupalchat_external_api_key'))
    ->set('drupalchat_app_id', $form_state
    ->getValue('drupalchat_app_id'))
    ->set('drupalchat_path_visibility', $form_state
    ->getValue('drupalchat_path_visibility'))
    ->set('drupalchat_path_pages', $form_state
    ->getValue('drupalchat_path_pages'))
    ->set('drupalchat_rel', $form_state
    ->getValue('drupalchat_rel'))
    ->set('drupalchat_ur_name', $form_state
    ->getValue('drupalchat_ur_name'))
    ->set('drupalchat_theme', $form_state
    ->getvalue('drupalchat_theme'))
    ->set('drupalchat_notification_sound', $form_state
    ->getValue('drupalchat_notification_sound'))
    ->set('drupalchat_user_picture', $form_state
    ->getValue('drupalchat_user_picture'))
    ->set('drupalchat_enable_smiley', $form_state
    ->getValue('drupalchat_enable_smiley'))
    ->set('drupalchat_log_messages', $form_state
    ->getValue('drupalchat_log_messages'))
    ->set('drupalchat_anon_use_name', $form_state
    ->getValue('drupalchat_anon_use_name'))
    ->set('drupalchat_user_latency', $form_state
    ->getValue('drupalchat_user_latency'))
    ->set('drupalchat_anon_prefix', $form_state
    ->getValue('drupalchat_anon_prefix'))
    ->set('drupalchat_refresh_rate', $form_state
    ->getValue('drupalchat_refresh_rate'))
    ->set('drupalchat_enable_chatroom', $form_state
    ->getValue('drupalchat_enable_chatroom'))
    ->set('drupalchat_session_caching', $form_state
    ->getValue('drupalchat_session_caching'))
    ->save();
}