We have a content type "Somali Page" that we want to refer to a Site Page ('English Page'). We added a dropdown node reference field to Somali Page and select a parent English Site page (About Us). When we view the Somali Page, we get these error messages:

Notice: Undefined index: node in node_reference_field_formatter_view() (line 435 of /var/www/dev.oneearthfuture.org/htdocs/sites/all/modules/contrib-stable/references/node_reference/node_reference.module).
EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7734 of /var/www/dev.oneearthfuture.org/htdocs/includes/common.inc).

Here is the code snippet leading up to that code

$settings = $display['settings'];
  $result = array();

  switch ($display['type']) {
    case 'node_reference_default':
    case 'node_reference_plain':
      foreach ($items as $delta => $item) {
        if ($item['access']) {
          $node = $item['node'];

Here is the Items array that code was processing:
[0] => Array
(
[nid] => 15
[access] => 1
)

As you can see, the code is looking for [node], but the array only carries a [nid].

Methinks this is a version incompatibility between References and Fields?

I can modify this pretty easily:

$nid = $item['nid'];
$node = node_load($nid);

, but do you have a patch, are you working on the issue?

CommentFileSizeAuthor
#1 notice_undefined-2297511-1.patch562 bytesrenatog
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

renatog’s picture

Hi!

Thank you very much for reporting.

This error was fixed. Exists new logic for check if node exists, and if not exists was used node_lod($nid) for get the node.

Good Work.

  • RenatoG committed 0b72aa3 on 7.x-2.x
    Issue #2297511 by RenatoG, paullwolborsky: Notice: Undefined index: node...
renatog’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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