You are here

public function FieldEncryptDecryptForm::submitForm in Field Encryption 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 FormInterface::submitForm

File

src/Form/FieldEncryptDecryptForm.php, line 103

Class

FieldEncryptDecryptForm
Confirmation form for removing encryption on field.

Namespace

Drupal\field_encrypt\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $storage = $this->entityTypeManager
    ->getStorage('field_storage_config');
  $field_storage_config = $storage
    ->load($this->entityType . '.' . $this->fieldName);
  $field_storage_config
    ->unsetThirdPartySetting('field_encrypt', 'encrypt');
  $field_storage_config
    ->unsetThirdPartySetting('field_encrypt', 'properties');
  $field_storage_config
    ->unsetThirdPartySetting('field_encrypt', 'encryption_profile');
  $field_storage_config
    ->save();
  $form_state
    ->setRedirectUrl($this
    ->getCancelUrl());
}