Implements 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->value) {
return check_markup($this->text->value, $this->format->value, $entity
->language()->langcode);
}
else {
// If no format is available, still make sure to sanitize the text.
return check_plain($this->text->value);
}
}