Skip to content

Commit

Permalink
Merge pull request #125 from OS2Forms/develop
Browse files Browse the repository at this point in the history
Release 3.15.7
  • Loading branch information
jekuaitk authored Aug 15, 2024
2 parents e1eb43c + f0ee398 commit c06eb97
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ before starting to add changes. Use example [placed in the end of the page](#exa

## [Unreleased]

## [3.15.7] 2024-08-15

- [#123](https://github.com/OS2Forms/os2forms/pull/123)
Encrypt subelements

## [3.15.6] 2024-07-16

- [#120](https://github.com/OS2Forms/os2forms/pull/120)
Expand Down Expand Up @@ -252,7 +257,10 @@ before starting to add changes. Use example [placed in the end of the page](#exa
- Security in case of vulnerabilities.
```

[Unreleased]: https://github.com/OS2Forms/os2forms/compare/3.15.4...HEAD
[Unreleased]: https://github.com/OS2Forms/os2forms/compare/3.15.7...HEAD
[3.15.7]: https://github.com/OS2Forms/os2forms/compare/3.15.6...3.15.7
[3.15.6]: https://github.com/OS2Forms/os2forms/compare/3.15.5...3.15.6
[3.15.5]: https://github.com/OS2Forms/os2forms/compare/3.15.4...3.15.5
[3.15.4]: https://github.com/OS2Forms/os2forms/compare/3.15.3...3.15.4
[3.15.3]: https://github.com/OS2Forms/os2forms/compare/3.15.2...3.15.3
[3.15.2]: https://github.com/OS2Forms/os2forms/compare/3.15.1...3.15.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ public function enabledEncrypt(): void {

$defaultEncryptionProfile = $config->get('default_encryption_profile');

if (!$defaultEncryptionProfile) {
$this->output()->writeln('Default encryption profile is missing. Set one and try again.');
return;
}

// Get the storage for Webform entity type.
$webformStorage = $this->entityTypeManager->getStorage('webform');

Expand All @@ -66,12 +71,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,
Expand Down
2 changes: 1 addition & 1 deletion modules/os2forms_encrypt/src/Helper/Os2FormsEncryptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c06eb97

Please sign in to comment.