TextProcessed::getValue

public TextProcessed::getValue()

Gets the data value.

Return value

mixed

Overrides TypedData::getValue

File

core/modules/text/src/TextProcessed.php, line 38

Class

TextProcessed
A computed property for processing text with a format.

Namespace

Drupal\text

Code

public function getValue() {
  if ($this->processed !== NULL) {
    return $this->processed;
  }

  $item = $this->getParent();
  $text = $item->{($this->definition->getSetting('text source'))};

  // Avoid running check_markup() on empty strings.
  if (!isset($text) || $text === '') {
    $this->processed = '';
  }
  else {
    $this->processed = check_markup($text, $item->format, $item->getLangcode());
  }
  return $this->processed;
}
doc_Drupal
2016-10-29 09:47:41
Comments
Leave a Comment

Please login to continue.