You are here

public static function WebformContentCreatorUtilities::getDecryptedValue in Webform Content Creator 8

Same name and namespace in other branches
  1. 3.x src/WebformContentCreatorUtilities.php \Drupal\webform_content_creator\WebformContentCreatorUtilities::getDecryptedValue()
  2. 2.x src/WebformContentCreatorUtilities.php \Drupal\webform_content_creator\WebformContentCreatorUtilities::getDecryptedValue()

Get decrypted value.

Parameters

string $value: Encrypted value.

string $encryption_profile: Encryption profile.

Return value

string Decrypted value

2 calls to WebformContentCreatorUtilities::getDecryptedValue()
WebformContentCreatorEntity::getDecryptionFromProfile in src/Entity/WebformContentCreatorEntity.php
Get decrypted value with the configured encryption profile.
WebformContentCreatorUtilities::getDecryptedTokenValue in src/WebformContentCreatorUtilities.php
Get decrypted values inside text with tokens.

File

src/WebformContentCreatorUtilities.php, line 337

Class

WebformContentCreatorUtilities
Provides useful functions required in Webform content creator module.

Namespace

Drupal\webform_content_creator

Code

public static function getDecryptedValue($value, $encryption_profile) {
  if (empty($value) || empty($encryption_profile)) {
    return '';
  }
  $dec_value = \Drupal::service('encryption')
    ->decrypt($value, $encryption_profile);
  if ($dec_value === FALSE) {
    $dec_value = $value;
  }
  return $dec_value;
}