I always got this Error when some content will be referenzed by node_reference:

Undefined index: nid in node_reference_field_formatter_view() (line 481 of [..]/sites/all/modules/_basic/references/node_reference/node_reference.module)

My Solution was the following in node_reference.module:

427:

- $node = $item['node'];
+ //$node = $item['node'];
+ $node = isset($item['node']) ? $item['node'] : node_load($item['nid']);

477:
- $nodes_display[$item['nid']] = $item['node'];
+ $node_object = node_load($item['nid']);
+ $nodes_display[$item['nid']] = $node_object;

Now all works again. If some other has the same problem hope this will help!

Comments

kleinmp’s picture

Version: 7.x-2.1 » 7.x-2.x-dev
Issue summary: View changes
StatusFileSize
new1.1 KB

I am running into this same issue. It's a little more sinister than an undefined index as noted in #2016021: EntityMalformedException when previewing node with node reference field :

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

Here's a patch for the dev version of the module (similar to comment 1).

jenlampton’s picture

Status: Patch (to be ported) » Needs review

I don't think this needs to be ported, changing status.

Also, could someone please add steps to reproduce, and possibly PHP version too?

renatog’s picture

Assigned: Unassigned » renatog
Status: Needs review » Reviewed & tested by the community
Issue tags: +ciandt-contrib

Hi people.

I applied the patch manually and works good for me.

Thank you very much for contribution.

Regards.

  • RenatoG committed df12780 on 7.x-2.x authored by oschaetzke
    Issue #2010572 by kleinmp, RenatoG, oschaetzke, jenlampton: Undefined...
renatog’s picture

Status: Reviewed & tested by the community » Fixed

Fixed.

Commited in dev branch.

Good Work and Good Weekend.

Regards.

Status: Fixed » Closed (fixed)

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