You are here

public function ExifSettingsForm::submitForm in Exif 8.2

Same name and namespace in other branches
  1. 8 src/Controller/ExifSettingsForm.php \Drupal\exif\Controller\ExifSettingsForm::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/Controller/ExifSettingsForm.php, line 242

Class

ExifSettingsForm
Manage Settings forms.

Namespace

Drupal\exif\Controller

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  foreach ([
    'nodetypes',
    'filetypes',
    'mediatypes',
  ] as $entity_type) {
    $value = $form_state
      ->getValue($entity_type);
    if (empty($value)) {
      $value = [];
    }
    $this
      ->config('exif.settings')
      ->set($entity_type, $value);
  }
  $this
    ->config('exif.settings')
    ->set('update_metadata', $form_state
    ->getValue('update_metadata', TRUE))
    ->set('write_empty_values', $form_state
    ->getValue('write_empty_values', FALSE))
    ->set('vocabulary', $form_state
    ->getValue('vocabulary', "0"))
    ->set('granularity', $form_state
    ->getValue('granularity'))
    ->set('date_format_exif', $form_state
    ->getValue('date_format_exif'))
    ->set('extraction_solution', $form_state
    ->getValue('extraction_solution'))
    ->set('exiftool_location', $form_state
    ->getValue('exiftool_location'))
    ->save();
  parent::submitForm($form, $form_state);
}