I use paragraphs and commerce products references fields. In this case, display_cache_field_attach_view_alter() does not have $output['#bundle'] nor $first_field['#bundle']. At this point (line 339), $first_child is not an array but my object entity (commerce_product).

No #bundle data, even in object but we can get information thanks to common core method like entity_extract_ids().

Fatal error occurs displaying or editing node :

Error : Cannot use object of type stdClass as array in display_cache_field_attach_view_alter() (ligne 340 display_cache/display_cache.module )

Follow a patch to use entity_extract_ids() to find bundle in case we deal with entity object.

CommentFileSizeAuthor
#2 issue_getting_bundle-2832135-2.patch1002 bytesgoz

Comments

GoZ created an issue. See original summary.

goz’s picture

Status: Active » Needs review
StatusFileSize
new1002 bytes
mfernea’s picture

Status: Needs review » Reviewed & tested by the community

The patch works well.