public function DataFieldRow::render in Drupal 8
Same name and namespace in other branches
- 9 core/modules/rest/src/Plugin/views/row/DataFieldRow.php \Drupal\rest\Plugin\views\row\DataFieldRow::render()
- 10 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 136
Class
- DataFieldRow
- Plugin which displays fields as raw data.
Namespace
Drupal\rest\Plugin\views\rowCode
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;
}