diff --git a/core/modules/views/src/Entity/Render/EntityFieldRenderer.php b/core/modules/views/src/Entity/Render/EntityFieldRenderer.php index 031dd99..82f6265 100644 --- a/core/modules/views/src/Entity/Render/EntityFieldRenderer.php +++ b/core/modules/views/src/Entity/Render/EntityFieldRenderer.php @@ -125,43 +125,49 @@ public function query(QueryPluginBase $query, $relationship = NULL) { public function render(ResultRow $row, Field $field = NULL) { // The method is called for each field in each result row. In order to // leverage multiple-entity building of formatter output, we build the // render arrays for all fields in all rows on the first call. if (!isset($this->build)) { $this->build = $this->buildFields($this->view->result); } if (isset($field)) { $field_id = $field->options['id']; // Pick the render array for the row / field we are being asked to render, // and remove it from $this->build to free memory as we progress. if (isset($this->build[$row->index][$field_id])) { $build = $this->build[$row->index][$field_id]; unset($this->build[$row->index][$field_id]); } else { // In the uncommon case where a field gets rendered several times // (typically through direct Views API calls), the pre-computed render // array was removed by the unset() above. We have to manually rebuild // the render array for the row. - $build = $this->buildFields([$row])[$row->index][$field_id]; + $build_fields = $this->buildFields([$row]); + if (isset($build_fields[$row->index])) { + $build = $build_fields[$row->index][$field_id]; + } + else { + $build = []; + } } } else { // Same logic as above, in the case where we are being called for a whole // row. if (isset($this->build[$row->index])) { $build = $this->build[$row->index]; unset($this->build[$row->index]); } else { $build = $this->buildFields([$row])[$row->index]; } } return $build; } /** * Builds the render arrays for all fields of all result rows. * * The output is built using EntityViewDisplay objects to leverage