You are here

public function Markup::render in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/src/Plugin/views/field/Markup.php \Drupal\views\Plugin\views\field\Markup::render()

Renders the field.

Parameters

\Drupal\views\ResultRow $values: The values retrieved from a single row of a view's query result.

Return value

string|\Drupal\Component\Render\MarkupInterface The rendered output. If the output is safe it will be wrapped in an object that implements MarkupInterface. If it is empty or unsafe it will be a string.

Overrides FieldPluginBase::render

File

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

Class

Markup
A handler to run a field through check_markup, using a companion 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) {
    $value = str_replace('<!--break-->', '', $value);
    return check_markup($value, $format);
  }
}