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().

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jidrone created an issue. See original summary.

jidrone’s picture

Status: Active » Needs review

Created MR and moved to needs review

e0ipso’s picture

Status: Needs review » Fixed

This looks good to me! Merging.

e0ipso’s picture

  • jidrone committed c535c00a on 1.x
    Issue #3382362: Get entity_type in a more reliable way
    

  • e0ipso committed 1c3905e7 on 1.x authored by jidrone
    Issue #3382362 by jidrone, e0ipso: Get entity_type in a more reliable...
e0ipso’s picture

I added a second commit to fix issue credit.

//www.flaticon.com/free-icons/thank-you Thank you for your contribution! Your continued support to this project makes my volunteer contributions more sustainable.
There are multiple ways to show appreciation for the work I did in this project, those include:
  • Triaging issues, and adding more context to existing issues.
  • Writing documentation, or patches for this project.
  • Writing blog posts, speaking about it at conferences.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.