You are here

public function TextProcessed::getValue in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/text/src/TextProcessed.php \Drupal\text\TextProcessed::getValue()

Gets the data value.

Return value

mixed

Overrides TypedData::getValue

File

core/modules/text/src/TextProcessed.php, line 43
Contains \Drupal\text\TextProcessed.

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;
}