You are here

public function MimeDetectSettingsForm::submitForm in MimeDetect 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/MimeDetectSettingsForm.php, line 144

Class

MimeDetectSettingsForm
Configure MimeDetect settings for this site.

Namespace

Drupal\mimedetect\Form

Code

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

  // Save settings changes.
  $config = $this
    ->config('mimedetect.settings');
  $config
    ->set('fileinfo.enable', $form_state
    ->getValue('fileinfo_enable'));
  $config
    ->set('unixfile.enable', $form_state
    ->getValue('unixfile_enable'));
  $config
    ->set('unixfile.binary', $form_state
    ->getValue('unixfile_binary'));
  $config
    ->set('magicfile', $form_state
    ->getValue('magicfile'));
  $config
    ->save();
  parent::submitForm($form, $form_state);
}