Versions

Drupal: 9.3.x, 9.4.x, 10
Gatsby: 2.0.0-beta2, 2.0.x

Problem/Motivation

When enabling the "Gatsby iframe preview" field (Manage Display) on a content type Drupal\Core\Entity\Controller\EntityViewController->buildTitle() produces a Notice

Steps to reproduce

1. Drag the "Gatsby iframe preview" field from Disabled on a content type
2. Create content using that content type
3. Error will be displayed on the node view

notice

Proposed resolution

When gatsby_entity_view() replaces the $build array add the missing #node key:
$build['#node'] = $entity;

Remaining tasks

Create a patch.

User interface changes

API changes

Data model changes

Comments

scottalan created an issue. See original summary.

scottalan’s picture

StatusFileSize
new587 bytes
scottalan’s picture

Status: Active » Needs review
damienmckenna’s picture

What happens if you just remove the $build=[] line?

scottalan’s picture

It renders any other fields that aren't disabled on the content type. In that case I guess one can just disable fields they don't want to see. I'm not sure there's any other reason $build is reinitialized as an empty array.

damienmckenna’s picture

Parent issue: » #3255274: Plan for Gatsby 2.0.0-rc1
StatusFileSize
new600 bytes

Thanks for confirming it. This is the fix we need so that the entity display works as expected.

scottalan’s picture

Sounds good

damienmckenna’s picture

Assigned: scottalan » Unassigned
damienmckenna’s picture

Status: Needs review » Reviewed & tested by the community

damienmckenna’s picture

Status: Reviewed & tested by the community » Fixed

Committed. Thank you!

Status: Fixed » Closed (fixed)

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