Skip to content

Commit

Permalink
1062: Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jekuaitk committed Jun 25, 2024
1 parent 34432c5 commit 4d27bcd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 7 additions & 6 deletions modules/os2forms_encrypt/src/Helper/Os2FormsEncryptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

/**
Expand All @@ -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
Expand All @@ -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');
Expand Down

0 comments on commit 4d27bcd

Please sign in to comment.