You are here

public function ClamAVConfigForm::submitForm in ClamAV 8

Same name and namespace in other branches
  1. 2.x src/Form/ClamAVConfigForm.php \Drupal\clamav\Form\ClamAVConfigForm::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/ClamAVConfigForm.php, line 215

Class

ClamAVConfigForm
Configure file system settings for this site.

Namespace

Drupal\clamav\Form

Code

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

  // Configure the stream-wrapper schemes that are overridden.
  // Local schemes behave differently to remote schemes.
  $local_schemes_to_scan = is_array($form_state
    ->getValue('clamav_local_schemes')) ? array_filter($form_state
    ->getValue('clamav_local_schemes')) : array();
  $remote_schemes_to_scan = is_array($form_state
    ->getValue('clamav_remote_schemes')) ? array_filter($form_state
    ->getValue('clamav_remote_schemes')) : array();
  $overridden_schemes = array_merge($this
    ->get_overridden_schemes('local', $local_schemes_to_scan), $this
    ->get_overridden_schemes('remote', $remote_schemes_to_scan));
  $this
    ->config('clamav.settings')
    ->set('enabled', $form_state
    ->getValue('enabled'))
    ->set('outage_action', $form_state
    ->getValue('outage_action'))
    ->set('overridden_schemes', $overridden_schemes)
    ->set('scan_mode', $form_state
    ->getValue('scan_mode'))
    ->set('verbosity', $form_state
    ->getValue('verbosity'))
    ->set('mode_executable.executable_path', $form_state
    ->getValue('executable_path'))
    ->set('mode_executable.executable_parameters', $form_state
    ->getValue('executable_parameters'))
    ->set('mode_daemon_tcpip.hostname', $form_state
    ->getValue('hostname'))
    ->set('mode_daemon_tcpip.port', $form_state
    ->getValue('port'))
    ->set('mode_daemon_unixsocket.unixsocket', $form_state
    ->getValue('unixsocket'))
    ->save();
  parent::submitForm($form, $form_state);
}