Undefined array key "#contextual_links" in sdc_display_entity_view_alter() for block width SDC display in layout builder

Created on 19 October 2023, 8 months ago
Updated 31 October 2023, 8 months ago

Problem/Motivation

Currently there is the following PHP warning when you have an inline block entity with SDC display in layout builder UI:

Warning: Undefined array key "#contextual_links" in sdc_display_entity_view_alter() (line 340 of modules/contrib/sdc_display/sdc_display.module).

Steps to reproduce

  • Create a custom block type with some field(s) and enable SDC display on it default view mode
  • Use the layout builder (e.g. on a node) and add a block of the custom type created before
  • There will be the above mentioned warning

Proposed resolution

  • Check $build['#contextual_links'] for existence before using it and fall back to an empty array otherwise

Remaining tasks

  • Create patch/MR to fix the issue

User interface changes

n/a

API changes

Data model changes

n/a

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇩🇪Germany hctom

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

Comments & Activities

Production build 0.69.0 2024