diff --git a/modules/os2forms_encrypt/src/Commands/Os2FormsEncryptCommands.php b/modules/os2forms_encrypt/src/Commands/Os2FormsEncryptCommands.php index a34153e..30deb68 100644 --- a/modules/os2forms_encrypt/src/Commands/Os2FormsEncryptCommands.php +++ b/modules/os2forms_encrypt/src/Commands/Os2FormsEncryptCommands.php @@ -66,12 +66,12 @@ public function enabledEncrypt(): void { /** @var \Drupal\webform\Entity\Webform $webform */ foreach ($webforms as $webform) { - $elements = $webform->getElementsDecoded(); + $elements = $webform->getElementsDecodedAndFlattened(); $config = $webform->getThirdPartySettings('webform_encrypt'); $changed = FALSE; foreach ($elements as $key => $element) { - if (!isset($config['element'][$key])) { + if (!isset($config['element'][$key]) || $config['element'][$key]['encrypt_profile'] === NULL) { $config['element'][$key] = [ 'encrypt' => TRUE, 'encrypt_profile' => $defaultEncryptionProfile, diff --git a/modules/os2forms_encrypt/src/Helper/Os2FormsEncryptor.php b/modules/os2forms_encrypt/src/Helper/Os2FormsEncryptor.php index bc40911..6e856ac 100644 --- a/modules/os2forms_encrypt/src/Helper/Os2FormsEncryptor.php +++ b/modules/os2forms_encrypt/src/Helper/Os2FormsEncryptor.php @@ -89,7 +89,7 @@ public function enableEncryption(WebformInterface $webform): void { } // Check that there are any elements to enable encryption on. - $elements = $webform->getElementsDecoded(); + $elements = $webform->getElementsDecodedAndFlattened(); if (empty($elements)) { return;