Same name and namespace in other branches
  1. 8.x-2.x src/Form/ExifSettingsForm.php \Drupal\exif\Form\ExifSettingsForm::submitForm() 1 comment

File

src/Controller/ExifSettingsForm.php, line 237

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);
}