Warning Undefined array key "entity_id" in checkContentFields

Created on 10 October 2024, 3 months ago

Problem/Motivation

In the issue https://www.drupal.org/i/3039979 a new method "checkContentFields" was added.
The method produces a warning and consequently, an error if the menu link plugin definition doesn't have an entity_id key.
It can happen that the plugin definition only holds node_id or e.g. taxonomy_term_id.

Warning: Undefined array key "entity_id" in Drupal\rest_menu_items\Plugin\rest\resource\RestMenuItemsResource->checkContentFields() (Zeile 494 in /var/www/web/modules/contrib/rest_menu_items/src/Plugin/rest/resource/RestMenuItemsResource.php)

Error when loading menu link content with NULL id:
AssertionError: Cannot load the "menu_link_content" entity with NULL ID.

Steps to reproduce

Proposed resolution

Check if the "entity_id" key exists before accessing it.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇷🇸Serbia petar_basic

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