summaryrefslogtreecommitdiffstats
path: root/core/lib/Drupal/Core/TypedData/DataDefinition.php
diff options
context:
space:
mode:
authorLee Rowlands2017-11-06 09:14:37 +1000
committerLee Rowlands2017-11-06 09:14:37 +1000
commitc74c39e13327809f442a0b309b7a995da8a9c6fa (patch)
treee1a432f5dbf88aca88e23ec50e6c2a227e1576f7 /core/lib/Drupal/Core/TypedData/DataDefinition.php
parentf2c1ef4f168acda23ec09d9af0cd7d7fe24440cc (diff)
Issue #2871591 by tedbow, Wim Leers, dagmar, borisson_, amateescu, dawehner, damiankloip, tstoeckler, mradcliffe, larowlan: Allow ComplexData in TypedData to specify computed properties that should be exposed in normalization and other contexts
Diffstat (limited to 'core/lib/Drupal/Core/TypedData/DataDefinition.php')
-rw-r--r--core/lib/Drupal/Core/TypedData/DataDefinition.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/core/lib/Drupal/Core/TypedData/DataDefinition.php b/core/lib/Drupal/Core/TypedData/DataDefinition.php
index 52a4394..332659f 100644
--- a/core/lib/Drupal/Core/TypedData/DataDefinition.php
+++ b/core/lib/Drupal/Core/TypedData/DataDefinition.php
@@ -352,4 +352,28 @@ class DataDefinition implements DataDefinitionInterface, \ArrayAccess {
return array_keys($vars);
}
+ /**
+ * {@inheritdoc}
+ */
+ public function isInternal() {
+ // Respect the definition, otherwise default to TRUE for computed fields.
+ if (isset($this->definition['internal'])) {
+ return $this->definition['internal'];
+ }
+ return $this->isComputed();
+ }
+
+ /**
+ * Sets the whether the data value should be internal.
+ *
+ * @param bool $internal
+ * Whether the data value should be internal.
+ *
+ * @return $this
+ */
+ public function setInternal($internal) {
+ $this->definition['internal'] = $internal;
+ return $this;
+ }
+
}