TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in in_array() EntityReferenceOverrideEntityFormatter.php

Created on 10 September 2025, 4 days ago

Problem/Motivation

Unable to configure or change the display of an entity_reference_override field which uses a View to select the targets. Error:

TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in in_array() (line 53 of modules/contrib/entity_reference_override/src/Plugin/Field/FieldFormatter/EntityReferenceOverrideEntityFormatter.php).

Steps to reproduce

Add an entity reference w/custom text field to a content type, configure it to use an entity reference view as a target selection method.

Go to the manage display tab and try to change the settings for Display from Label to Rendered Entity.

Proposed resolution

Handle it in the array_filter function.

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇬🇧United Kingdom nicrodgers Monmouthshire, UK

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

Merge Requests

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