You are here

public function MediaDirectoriesConfigForm::submitForm in Media Directories 8

Same name and namespace in other branches
  1. 3.x src/Form/MediaDirectoriesConfigForm.php \Drupal\media_directories\Form\MediaDirectoriesConfigForm::submitForm()
  2. 2.x src/Form/MediaDirectoriesConfigForm.php \Drupal\media_directories\Form\MediaDirectoriesConfigForm::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/MediaDirectoriesConfigForm.php, line 101

Class

MediaDirectoriesConfigForm
Media directories configuration form.

Namespace

Drupal\media_directories\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this
    ->config('media_directories.settings')
    ->set('directory_taxonomy', $form_state
    ->getValue('directory_taxonomy'))
    ->set('all_files_in_root', $form_state
    ->getValue('all_files_in_root'))
    ->save();

  // Clear cache to change base field settings.
  // @see media_directories_entity_base_field_info().
  drupal_flush_all_caches();
  parent::submitForm($form, $form_state);
}