You are here

public function ComputedString::getValue in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/system/tests/modules/entity_test/src/TypedData/ComputedString.php \Drupal\entity_test\TypedData\ComputedString::getValue()

Gets the data value.

Return value

mixed The data value.

Overrides TypedData::getValue

File

core/modules/system/tests/modules/entity_test/src/TypedData/ComputedString.php, line 17

Class

ComputedString
A computed property for test strings.

Namespace

Drupal\entity_test\TypedData

Code

public function getValue() {

  /** @var \Drupal\Core\Field\FieldItemInterface $item */
  $item = $this
    ->getParent();
  $computed_value = "Computed! " . $item
    ->get('value')
    ->getString();
  return $computed_value;
}