EncryptedFieldComputedProperty.php in Field Encryption 3.0.x
File
src/EncryptedFieldComputedProperty.php
View source
<?php
namespace Drupal\field_encrypt;
use Drupal\Core\TypedData\TypedData;
class EncryptedFieldComputedProperty extends TypedData {
protected $decryptedData = NULL;
public function getValue() {
if ($this->decryptedData === NULL) {
$item = $this
->getParent();
$this->decryptedData = $item
->decrypt();
}
return $this->decryptedData;
}
public function setValue($value, $notify = TRUE) {
$this->decryptedData = $value;
if ($notify && isset($this->parent)) {
$this->parent
->onChange($this->name);
}
}
}