Skip to content

Commit c06eb97

Browse files
authored
Merge pull request #125 from OS2Forms/develop
Release 3.15.7
2 parents e1eb43c + f0ee398 commit c06eb97

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ before starting to add changes. Use example [placed in the end of the page](#exa
1111

1212
## [Unreleased]
1313

14+
## [3.15.7] 2024-08-15
15+
16+
- [#123](https://github.com/OS2Forms/os2forms/pull/123)
17+
Encrypt subelements
18+
1419
## [3.15.6] 2024-07-16
1520

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

255-
[Unreleased]: https://github.com/OS2Forms/os2forms/compare/3.15.4...HEAD
260+
[Unreleased]: https://github.com/OS2Forms/os2forms/compare/3.15.7...HEAD
261+
[3.15.7]: https://github.com/OS2Forms/os2forms/compare/3.15.6...3.15.7
262+
[3.15.6]: https://github.com/OS2Forms/os2forms/compare/3.15.5...3.15.6
263+
[3.15.5]: https://github.com/OS2Forms/os2forms/compare/3.15.4...3.15.5
256264
[3.15.4]: https://github.com/OS2Forms/os2forms/compare/3.15.3...3.15.4
257265
[3.15.3]: https://github.com/OS2Forms/os2forms/compare/3.15.2...3.15.3
258266
[3.15.2]: https://github.com/OS2Forms/os2forms/compare/3.15.1...3.15.2

modules/os2forms_encrypt/src/Commands/Os2FormsEncryptCommands.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ public function enabledEncrypt(): void {
5858

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

61+
if (!$defaultEncryptionProfile) {
62+
$this->output()->writeln('Default encryption profile is missing. Set one and try again.');
63+
return;
64+
}
65+
6166
// Get the storage for Webform entity type.
6267
$webformStorage = $this->entityTypeManager->getStorage('webform');
6368

@@ -66,12 +71,12 @@ public function enabledEncrypt(): void {
6671

6772
/** @var \Drupal\webform\Entity\Webform $webform */
6873
foreach ($webforms as $webform) {
69-
$elements = $webform->getElementsDecoded();
74+
$elements = $webform->getElementsDecodedAndFlattened();
7075
$config = $webform->getThirdPartySettings('webform_encrypt');
7176

7277
$changed = FALSE;
7378
foreach ($elements as $key => $element) {
74-
if (!isset($config['element'][$key])) {
79+
if (!isset($config['element'][$key]) || $config['element'][$key]['encrypt_profile'] === NULL) {
7580
$config['element'][$key] = [
7681
'encrypt' => TRUE,
7782
'encrypt_profile' => $defaultEncryptionProfile,

modules/os2forms_encrypt/src/Helper/Os2FormsEncryptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function enableEncryption(WebformInterface $webform): void {
8989
}
9090

9191
// Check that there are any elements to enable encryption on.
92-
$elements = $webform->getElementsDecoded();
92+
$elements = $webform->getElementsDecodedAndFlattened();
9393

9494
if (empty($elements)) {
9595
return;

0 commit comments

Comments
 (0)