Error with empty single-value field

Created on 30 October 2020, about 4 years ago
Updated 5 February 2024, 9 months ago

Problem/Motivation

When exporting an optional, single-valued entity reference field which does not have a value, rest_views displays a warning like:

Warning: reset() expects parameter 1 to be array, null given in /var/www/html/drupal/web/modules/contrib/rest_views/src/Plugin/Field/FieldFormatter/EntityReferenceExportFormatter.php on line 100

Steps to reproduce

Create a paragraph, which has one field which is an entity reference. Ensure this field is single-valued, and optional. Add an instance of that paragraph to a content type, then export that using rest_views.

Proposed resolution

EntityReferenceExportFormatter should check if the field actually has a value.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Closed: outdated

Version

3.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom Alice Heaton

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024