diff --git a/core/modules/rest/lib/Drupal/rest/Plugin/views/row/DataFieldRow.php b/core/modules/rest/lib/Drupal/rest/Plugin/views/row/DataFieldRow.php index 5c72e12..d84da44 100644 --- a/core/modules/rest/lib/Drupal/rest/Plugin/views/row/DataFieldRow.php +++ b/core/modules/rest/lib/Drupal/rest/Plugin/views/row/DataFieldRow.php @@ -45,7 +45,7 @@ class DataFieldRow extends RowPluginBase { * * @var array */ - protected $rawOutput = array(); + protected $rawOutputOptions = array(); /** * Overrides \Drupal\views\Plugin\views\row\RowPluginBase::init(). @@ -59,7 +59,7 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o $aliases = static::extractFromOptionsArray('alias', $options); $this->replacementAliases = array_filter(array_map('trim', $aliases)); // Prepare an array of raw output field options. - $this->rawOutput = static::extractFromOptionsArray('raw_output', $options); + $this->rawOutputOptions = static::extractFromOptionsArray('raw_output', $options); } } @@ -139,8 +139,8 @@ public function render($row) { 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->rawOutput[$id])) { - $value = $field->sanitizeValue($row->{$field->field_alias}, 'xss_admin'); + if (($field->field_alias != 'unknown') && !empty($this->rawOutputOptions[$id])) { + $value = $field->sanitizeValue($field->get_value($row), 'xss_admin'); } // Otherwise, pass this through the field render() method. else { @@ -181,7 +181,7 @@ public function getFieldKeyAlias($id) { * @return array * A regular one dimensional array of values. */ - public static function extractFromOptionsArray($key, $options) { + protected static function extractFromOptionsArray($key, $options) { return array_map(function($item) use ($key) { return array_key_exists($key, $item) ? $item[$key] : NULL; }, $options); diff --git a/core/modules/rest/lib/Drupal/rest/Tests/Views/StyleSerializerTest.php b/core/modules/rest/lib/Drupal/rest/Tests/Views/StyleSerializerTest.php index 40259e3..e75e3d9 100644 --- a/core/modules/rest/lib/Drupal/rest/Tests/Views/StyleSerializerTest.php +++ b/core/modules/rest/lib/Drupal/rest/Tests/Views/StyleSerializerTest.php @@ -184,7 +184,7 @@ public function testUIFieldAlias() { $this->drupalPost(NULL, array(), t('Save')); $view = views_get_view('test_serializer_display_field'); - $view->setDisplay('ws_endpoint_1'); + $view->setDisplay('rest_export_1'); $this->executeView($view); $expected = array(); @@ -216,7 +216,7 @@ public function testFieldRawOutput() { $this->drupalPost(NULL, array(), t('Save')); $view = views_get_view('test_serializer_display_field'); - $view->setDisplay('ws_endpoint_1'); + $view->setDisplay('rest_export_1'); $this->executeView($view); // Just test the raw 'created' value against each row.