TypeError: entity_extra_field_display(): Argument #4 ($display) must be of type Drupal\Core\Entity\Display\EntityDisplayInterface, null given

Created on 9 October 2024, 2 months ago

Problem/Motivation

When trying to edit an entity with a non-admin user, I get the following error:
TypeError: entity_extra_field_display(): Argument #4 ($display) must be of type Drupal\Core\Entity\Display\EntityDisplayInterface, null given, called in /web/modules/contrib/entity_extra_field/entity_extra_field.module on line 78 in entity_extra_field_display() (line 111 of modules/contrib/entity_extra_field/entity_extra_field.module).

I found out that this is very specific and happens in Drupal commerce product editing, if the user doesn't have some permissions. But as it can happen, I'd suggest we should make this more robust, either by returning if $display is NULL in the call or making the parameter optional in the definition.

I'd vote for the first option.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

2.1

Component

Code

Created by

🇩🇪Germany Anybody Porta Westfalica

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024