You are here

public function DataFieldRow::render in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/rest/src/Plugin/views/row/DataFieldRow.php \Drupal\rest\Plugin\views\row\DataFieldRow::render()

Render a row object. This usually passes through to a theme template of some form, but not always.

Parameters

object $row: A single row of the query result, so an element of $view->result.

Return value

string The rendered output of a single row, used by the style plugin.

Overrides RowPluginBase::render

File

core/modules/rest/src/Plugin/views/row/DataFieldRow.php, line 137
Contains \Drupal\rest\Plugin\views\row\DataFieldRow.

Class

DataFieldRow
Plugin which displays fields as raw data.

Namespace

Drupal\rest\Plugin\views\row

Code

public function render($row) {
  $output = array();
  foreach ($this->view->field as $id => $field) {

    // If this is not unknown and the raw output option has been set, just get
    // the raw value.
    if ($field->field_alias != 'unknown' && !empty($this->rawOutputOptions[$id])) {
      $value = $field
        ->sanitizeValue($field
        ->getValue($row), 'xss_admin');
    }
    else {
      $value = $field
        ->advancedRender($row);
    }
    $output[$this
      ->getFieldKeyAlias($id)] = $value;
  }
  return $output;
}