Warning Error on User entity reference field: Undefined array key "base_plugin_label"

Created on 31 January 2024, 10 months ago
Updated 1 February 2024, 10 months ago

Problem/Motivation

There is a warning error when editing a User entity reference field:
Warning: Undefined array key "base_plugin_label"
Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem->fieldSettingsForm() (line 404 of /html/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php)

Steps to reproduce

Install latest version of Open Social (at the moment 12.0.5).
Edit any User entity reference field, for example here:
/admin/structure/types/manage/event/fields/node.event.field_event_managers
The Undefined array key "base_plugin_label" Error shows on watchdog.

Proposed resolution

Patch attached based on similar bug:
https://www.drupal.org/node/3414702
https://www.drupal.org/files/issues/2024-01-26/dynamic_entity_reference-...

The error disappears with the patch.

UPDATE: I have found an old issue with the same problem which was closed (outdated):
https://www.drupal.org/project/social/issues/3094529

The solution seems to be to add the base_plugin_label into the plugin definition. While that issue is not solved, this patch works as a temporary solution to make the warnings disappear.

Remaining tasks

Solve old issue:
https://www.drupal.org/project/social/issues/3094529
Meanwhile patch #1 eliminates the warnings.

User interface changes

Patch #1: core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php

🐛 Bug report
Status

Closed: duplicate

Version

12.0

Component

Code (back-end)

Created by

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

Comments & Activities

Production build 0.71.5 2024