Undefined array key "menu_link" in EntityReferencedDerivableContextDeriver::generateDefinitionsForReferencedEntityTypes()

Created on 29 November 2024, 27 days ago

Problem/Motivation

Currently after every cache clear I see the following PHP warning:

Warning: Undefined array key "menu_link" in Drupal\ui_patterns\Plugin\Derivative\EntityReferencedDerivableContextDeriver->generateDefinitionsForReferencedEntityTypes() (line 137)

But this only happens on (e.g. node) pages where the Data from a field source is used somewhere for a property of a component (the actual selected field source may be anything).

Steps to reproduce

  • Create an entity with layout builder overrides enabled or configure a view mode with layout builder
  • Add a component and use Data from a field source for any of its properties and map any of the available fields
  • Open up the page where this layout is used
  • Clear all caches
  • Refresh the page where the layout is used and see the PHP warning

Proposed resolution

  • Check for any potential underlying issue and/or adjust code of EntityReferencedDerivableContextDeriver::generateDefinitionsForReferencedEntityTypes() to be more defensive, so it may handle this case by e.g. ignoring that specific field by checking $this->entityFieldsMetadata[$entity_type_id]["field_storages"] for the existence of the field before using it

Remaining tasks

  • Create issue fork an MR to fix this issue

User interface changes

n/a

API changes

n/a

Data model changes

n/a

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇩🇪Germany hctom

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