Implements \Drupal\Core\TypedData\TypedDataInterface::getValue().
Overrides TypedData::getValue
public function getValue($langcode = NULL) {
if (!isset($this->text)) {
throw new InvalidArgumentException('Computed properties require context for computation.');
}
$field = $this->parent
->getParent();
$entity = $field
->getParent();
$instance = field_info_instance($entity
->entityType(), $field
->getName(), $entity
->bundle());
if (!empty($instance['settings']['text_processing']) && $this->format
->getValue()) {
return check_markup($this->text
->getValue(), $this->format
->getValue(), $entity
->language()->langcode);
}
else {
// If no format is available, still make sure to sanitize the text.
return check_plain($this->text
->getValue());
}
}