PrivateComputed.php in Private content 8.2
File
src/PrivateComputed.php
View source
<?php
namespace Drupal\private_content;
use Drupal\Core\TypedData\TypedData;
class PrivateComputed extends TypedData {
protected $computed = NULL;
public function getValue() {
if ($this->computed === NULL) {
$item = $this
->getParent();
$stored = $item->stored;
$list = $item
->getParent();
if ($stored === NULL || $list
->isLocked()) {
$this->computed = $list
->getDefault();
}
else {
$this->computed = $stored;
}
}
return $this->computed;
}
public function setValue($value, $notify = TRUE) {
$this->computed = $value;
if ($notify && isset($this->parent)) {
$this->parent
->onChange($this->name);
}
}
}
Classes
Name |
Description |
PrivateComputed |
A computed property for processing private value based on node content type settings. |