Get entity_type in a more reliable way

Created on 21 August 2023, 10 months ago
Updated 2 September 2023, 10 months ago

Problem/Motivation

The module is throwing this warning:

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

In my case the $build array does not contain the entity type.

Steps to reproduce

  1. Enable any view mode to be rendered as component.
  2. Render the entity using that view mode in anywhere.

Proposed resolution

Instead of getting the entity_type from the build array, we can get it from the entity itself, all entities should have the method getEntityTypeId().

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡¨πŸ‡΄Colombia jidrone

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

Comments & Activities

Production build 0.69.0 2024