You are here

public function FileSettingsForm::submitForm in File Entity (fieldable files) 8.2

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/FileSettingsForm.php, line 127

Class

FileSettingsForm
Class FileSettingsForm @package Drupal\file_entity\Form

Namespace

Drupal\file_entity\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this
    ->config('file_entity.settings')
    ->set('max_filesize', $form_state
    ->getValue('max_filesize'))
    ->set('default_allowed_extensions', $form_state
    ->getValue('default_allowed_extensions'))
    ->set('alt', $form_state
    ->getValue('file_entity_alt'))
    ->set('title', $form_state
    ->getValue('file_entity_title'))
    ->set('wizard_skip_file_type', $form_state
    ->getValue('wizard_skip_file_type'))
    ->set('wizard_skip_scheme', $form_state
    ->getValue('wizard_skip_scheme'))
    ->set('wizard_skip_fields', $form_state
    ->getValue('wizard_skip_fields'))
    ->save();
  $this
    ->messenger()
    ->addMessage(t('File Settings have been succesfully saved.'));
}