I have a node type with a node reference field. Widget: autocomplete, formatter: hidden.
If I edit a node with the field correctly filled in I get an error page with the following errors:
Notice: Undefined index: node in node_reference_field_formatter_view() (line 428 of /path/references/node_reference/node_reference.module).
EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7663 of /path/includes/common.inc).
If I save, I can view the node without errors.
The problem seems to be that on row 428, $item['node'] is not set:
$node = $item['node'];
And the reason for this seems to be that node_reference_field_formatter_prepare_view()
doesn't run when previewing nodes – only when viewing them. Changing row 428 like below fixes the problem:
$node = isset($item['node']) ? $item['node'] : node_load($item['nid']);
Drupal 7.22, References 7.x-2.1
Comments
Comment #1
Alex Andrascu CreditAttribution: Alex Andrascu commentedComment #2
Alex Andrascu CreditAttribution: Alex Andrascu commentedThanks for this. I'll give it a look.
Comment #3
Alex Andrascu CreditAttribution: Alex Andrascu commentedLooks like this is a duplicate of #2010572: Undefined index: nid in node_reference_field_formatter_view() (line 481 of [..]/sites/all/modules/_basic/references/node_referen
I'll close this one and we'll keep it there.