Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. DataFieldRow.php

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal