diff --git a/CHANGELOG.md b/CHANGELOG.md index e020e66..4b552c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,9 @@ before starting to add changes. Use example [placed in the end of the page](#exa ## [Unreleased] +- [#114](https://github.com/OS2Forms/os2forms/pull/114) + Encrypted computed elements. + ## [3.15.3] 2024-06-25 - [OS-74] Replacing DAWA matrikula select with Datafordeler select diff --git a/modules/os2forms_encrypt/src/Helper/Os2FormsEncryptor.php b/modules/os2forms_encrypt/src/Helper/Os2FormsEncryptor.php index b254f33..26b578b 100644 --- a/modules/os2forms_encrypt/src/Helper/Os2FormsEncryptor.php +++ b/modules/os2forms_encrypt/src/Helper/Os2FormsEncryptor.php @@ -2,14 +2,14 @@ namespace Drupal\os2forms_encrypt\Helper; -use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\encrypt\EncryptServiceInterface; use Drupal\encrypt\Entity\EncryptionProfile; -use Drupal\webform\Entity\WebformSubmission; use Drupal\webform\WebformInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; +/** + * The Os2FormsEncryptor class. + */ class Os2FormsEncryptor { /** @@ -26,13 +26,14 @@ class Os2FormsEncryptor { */ private EntityTypeManagerInterface $entityTypeManager; - public function __construct(EncryptServiceInterface $encryptService, EntityTypeManagerInterface $entityTypeManager) { $this->encryptionService = $encryptService; $this->entityTypeManager = $entityTypeManager; } /** + * Encrypts value if element is configured to be encrypted. + * * @param string $value * The value that should be encrypted. * @param string $element @@ -41,10 +42,10 @@ public function __construct(EncryptServiceInterface $encryptService, EntityTypeM * The webform id. * * @return string - * The encrypted string if element is configured to be encrypted. + * The resulting value. */ public function encryptValue(string $value, string $element, string $webformId): string { - /** @var WebformInterface $webform */ + /** @var \Drupal\webform\WebformInterface $webform */ $webform = $this->entityTypeManager->getStorage('webform')->load($webformId); $config = $webform->getThirdPartySetting('webform_encrypt', 'element');