public function SpambotSettingsForm::submitForm in Spambot 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/ SpambotSettingsForm.php, line 406
Class
- SpambotSettingsForm
- Settings form to save the configuration for Spambot.
Namespace
Drupal\spambot\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$config = $this
->config('spambot.settings');
$whitelist_email = explode(PHP_EOL, $form_state
->getValue('spambot_whitelist_email'));
$whitelist_username = explode(PHP_EOL, $form_state
->getValue('spambot_whitelist_username'));
$whitelist_ip = explode(PHP_EOL, $form_state
->getValue('spambot_whitelist_ip'));
$config
->set('spambot_criteria_email', $form_state
->getValue('spambot_criteria_email'))
->set('spambot_criteria_username', $form_state
->getValue('spambot_criteria_username'))
->set('spambot_criteria_ip', $form_state
->getValue('spambot_criteria_ip'))
->set('spambot_whitelist_email_list', array_map('trim', array_filter($whitelist_email)))
->set('spambot_whitelist_username_list', array_map('trim', array_filter($whitelist_username)))
->set('spambot_whitelist_ip_list', array_map('trim', array_filter($whitelist_ip)))
->set('spambot_user_register_protect', $form_state
->getValue('spambot_user_register_protect'))
->set('spambot_blacklisted_delay', $form_state
->getValue('spambot_blacklisted_delay'))
->set('spambot_cron_user_limit', $form_state
->getValue('spambot_cron_user_limit'))
->set('spambot_check_blocked_accounts', $form_state
->getValue('spambot_check_blocked_accounts'))
->set('spambot_spam_account_action', $form_state
->getValue('spambot_spam_account_action'))
->set('spambot_blocked_message_email', $form_state
->getValue('spambot_blocked_message_email'))
->set('spambot_blocked_message_username', $form_state
->getValue('spambot_blocked_message_username'))
->set('spambot_blocked_message_ip', $form_state
->getValue('spambot_blocked_message_ip'))
->set('spambot_log_blocked_registration', $form_state
->getValue('spambot_log_blocked_registration'))
->set('spambot_sfs_api_key', $form_state
->getValue('spambot_sfs_api_key'))
->set('spambot_enable_cache', $form_state
->getValue('spambot_enable_cache'))
->set('spambot_cache_expire', $form_state
->getValue('spambot_cache_expire'))
->set('spambot_cache_expire_false', $form_state
->getValue('spambot_cache_expire_false'))
->save();
$this->state
->set('spambot_last_checked_uid', $form_state
->getValue('spambot_last_checked_uid'));
parent::submitForm($form, $form_state);
}