You are here

public function GdprFieldSettingsForm::submitForm in General Data Protection Regulation 8

Same name and namespace in other branches
  1. 8.2 modules/gdpr_fields/src/Form/GdprFieldSettingsForm.php \Drupal\gdpr_fields\Form\GdprFieldSettingsForm::submitForm()
  2. 3.0.x modules/gdpr_fields/src/Form/GdprFieldSettingsForm.php \Drupal\gdpr_fields\Form\GdprFieldSettingsForm::submitForm()

Throws

\Drupal\Core\Entity\EntityStorageException

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

Overrides FormInterface::submitForm

File

modules/gdpr_fields/src/Form/GdprFieldSettingsForm.php, line 420

Class

GdprFieldSettingsForm
GDPR Field settings.

Namespace

Drupal\gdpr_fields\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  if ($form_state
    ->getTriggeringElement()['#name'] == 'Cancel') {
    $form_state
      ->setRedirect('gdpr_fields.fields_list');
    return;
  }
  $config = $this
    ->setConfig($form_state
    ->getValue('entity_type'), $form_state
    ->getValue('bundle'), $form_state
    ->getValue('field_name'), $form_state
    ->getValue('gdpr_enabled'), $form_state
    ->getValue('gdpr_rta'), $form_state
    ->getValue('gdpr_rtf'), $form_state
    ->getValue('gdpr_anonymizer'), $form_state
    ->getValue('gdpr_notes'), $form_state
    ->getValue('gdpr_relationship'), $form_state
    ->getValue('gdpr_sars_filename'));
  $config
    ->save();
  $this->messenger
    ->addMessage('Field settings saved.');
  $form_state
    ->setRedirect('gdpr_fields.fields_list');
}