function DataFieldRow::render

Same name in other branches
  1. 9 core/modules/rest/src/Plugin/views/row/DataFieldRow.php \Drupal\rest\Plugin\views\row\DataFieldRow::render()
  2. 8.9.x core/modules/rest/src/Plugin/views/row/DataFieldRow.php \Drupal\rest\Plugin\views\row\DataFieldRow::render()
  3. 11.x core/modules/rest/src/Plugin/views/row/DataFieldRow.php \Drupal\rest\Plugin\views\row\DataFieldRow::render()

Overrides RowPluginBase::render

File

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

Class

DataFieldRow
Plugin which displays fields as raw data.

Namespace

Drupal\rest\Plugin\views\row

Code

public function render($row) {
    $output = [];
    foreach ($this->view->field as $id => $field) {
        // If the raw output option has been set, just get the raw value.
        if (!empty($this->rawOutputOptions[$id])) {
            $value = $field->getValue($row);
        }
        else {
            // Advanced render for token replacement.
            $markup = $field->advancedRender($row);
            // Post render to support uncacheable fields.
            $field->postRender($row, $markup);
            $value = $field->last_render;
        }
        // Omit excluded fields from the rendered output.
        if (empty($field->options['exclude'])) {
            $output[$this->getFieldKeyAlias($id)] = $value;
        }
    }
    return $output;
}

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