function Markup::render

Same name and namespace in other branches
  1. 11.x core/modules/views/src/Plugin/views/field/Markup.php \Drupal\views\Plugin\views\field\Markup::render()
  2. 10 core/modules/views/src/Plugin/views/field/Markup.php \Drupal\views\Plugin\views\field\Markup::render()
  3. 9 core/modules/views/src/Plugin/views/field/Markup.php \Drupal\views\Plugin\views\field\Markup::render()
  4. 8.9.x core/modules/views/src/Plugin/views/field/Markup.php \Drupal\views\Plugin\views\field\Markup::render()

Overrides FieldPluginBase::render

File

core/modules/views/src/Plugin/views/field/Markup.php, line 45

Class

Markup
Handler to process text using a format field.

Namespace

Drupal\views\Plugin\views\field

Code

public function render(ResultRow $values) {
  $value = $this->getValue($values);
  if (is_array($this->format)) {
    $format = $this->getValue($values, 'format');
  }
  else {
    $format = $this->format;
  }
  if ($value) {
    return [
      '#type' => 'processed_text',
      '#text' => str_replace('<!--break-->', '', $value),
      '#format' => $format,
      '#langcode' => \Drupal::languageManager()->getCurrentLanguage()
        ->getId(),
    ];
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.