public function DecryptFieldForm::submitForm in Field Encryption 3.0.x
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/ DecryptFieldForm.php, line 114
Class
- DecryptFieldForm
- Confirmation form for removing encryption on field.
Namespace
Drupal\field_encrypt\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
if ($this->baseField) {
/** @var \Drupal\field_encrypt\Entity\FieldEncryptEntityType $field_encrypt_settings */
$field_encrypt_settings = $this->entityTypeManager
->getStorage('field_encrypt_entity_type')
->load($this->entityType);
$field_encrypt_settings
->removeBaseField($this->fieldName)
->save();
}
else {
$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
->save();
}
$form_state
->setRedirectUrl($this
->getCancelUrl());
}