I upgraded to latest dev version (02-Aug-2011) and I get the following error messages:

Fatal error: Call to a member function render() on a non-object in ....\sites\all\modules\references\views\references_plugin_style.inc on line 32
Notice: Undefined index: access in node_reference_field_formatter_view() (line 394 of ...\sites\all\modules\references\node_reference\node_reference.module).
Notice: Undefined index: taxonomy_term in taxonomy_field_formatter_view() (line 1418 of ...\modules\taxonomy\taxonomy.module).
EntityMalformedException: Missing bundle property on entity of type taxonomy_term. in entity_extract_ids() (line 7383 of ...\includes\common.inc).

I'm not sure if they are all caused by this module.

#18 node_reference.item-access.patch2.93 KBJohn Franklin
#12 1249268_node_reference_wsod-12.patch693 bytesAron Novak
PASSED: [[SimpleTest]]: [MySQL] 40 pass(es). View
#9 node_reference_php_warnings.patch655 bytesmh86
PASSED: [[SimpleTest]]: [MySQL] 14 pass(es). View
Members fund testing for the Drupal project. Drupal Association Learn more


chalee’s picture

I have investigated the errors and managed to make them go away.
a) The first and last 2 errors went away when i removed the nodes which had taxonomy terms whose parent vocabulary I had deleted.
b) I noticed the 2nd error is actually a bug in node_reference.module. The issues are in function node_reference_field_formatter_view().

 * Implements hook_field_formatter_view().
function node_reference_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $result = array();

  switch ($display['type']) {
    case 'node_reference_default':
    case 'node_reference_plain':
      foreach ($items as $delta => $item) {
        if ($item['access']) {
          $node = $item['node'];
          if ($display['type'] == 'node_reference_default') {
            $uri = entity_uri('node', $node);
            $result[$delta] = array(
              '#type' => 'link',
              '#title' => $node->title,
              '#href' => $uri['path'],
              '#options' => $uri['options'],
          else {
            $result[$delta] = array(
              '#markup' => check_plain($node->title),
          if (!$node->status) {
            $result[$delta]['#prefix'] = '<span class="node-unpublished">';
            $result[$delta]['#suffix'] = '</span>';

Problem 1: There is no implementation for display type 'node_reference_default' yet the function is in some instances being called with this display type
Temporary Fix: Combine first two cases

switch ($display['type']) {
   // case 'node_reference_default':
    case 'node_reference_plain' || 'node_reference_default': 
      foreach ($items as $delta => $item) {

Problem 2: The statement $node = $item['node'] does not work for node reference field in a field_collection_item.
solution: load the node if entity_type is field_collection_item

if ($entity_type == 'field_collection_item'){
		    	 $node = node_load($item['nid']);
		  } else{
		  	$node = $item['node'];	

Problem 3: The expression $item['access'] is also not available for node reference field in a field_collection_item.
Temporary Fix: disable/comment out checking for 'access'

tim.plunkett’s picture

Coming from #1250012: Notice: Undefined index: access in node_reference_field_formatter_view() .

The fix for problem 1 is redundant, that's how switch/case statements work, listing them back to back is a fall-through and is equivalent to what you've typed out.

While I was initially happy to hear it wasn't my bug, I still am not sure of this. References shouldn't care have to worry about field_collection_items, so the solution for problem 2 is likely not the best way. Though I'm not 100% on that.

When it's a field_collection_item, what is in $item['node']? If nothing, then this would be best:

$node = !empty($item['node']) ? $item['node'] : node_load($item['nid']);
chalee’s picture

@tim.plunkett: Thanks. I agree with all your points. $item['node'] doesn't exist for field_collection_item, therefore your suggested statement is the best to cater for any other module which doesn't set the value. How about if ($item['access']) { , Is it proper to bypass that check here when $item['access'] is not set or some other module has to set it. Which module would that be? Perhaps field_collection which creates the field instance in the first place or entity that loads the entity?

chalee’s picture

I'm noticing that this issue has far reaching effects. Apart from node reference it also affects field formatters for taxonomy and media modules i.e functions taxonomy_field_formatter_view() and media_field_formatter_view() respectively.

chrisroditis’s picture

Same problem here with node references and $item['access']. My node reference field is attached to a message entity (message.module) and I'm getting the Notice: Undefined index: access in node_reference_field_formatter_view() error

Jason Dean’s picture

Same issue here with References + Field Collection + Field Collection Table... subscribing.

mh86’s picture

subscribing, having the same problem

mh86’s picture

I'm having a view with messages which have a node reference field attached. I use this field for filtering the messages via a contextual argument - so no content of the node reference is actually shown.
Nevertheless, I receive lots of "Undefined index: access ..." warnings. As I can see from the code node_reference_field_formatter_view() needs node_reference_field_formatter_prepare_view() first, which isn't invoked in my case. But why is a formatter function ever invoked when I'm not showing the field?

mh86’s picture

Status: Active » Needs review
655 bytes
PASSED: [[SimpleTest]]: [MySQL] 14 pass(es). View

here a quick fix that prevents the warnings, but I'm not sure if it solves the original problem.

Sinan Erdem’s picture

I applied the patch on comment #9, but the error still appears on the status report page:

Notice: Undefined index: node in node_reference_field_formatter_view() (line 441 of /home/administrator/metalface/sites/all/modules/references/node_reference/node_reference.module).

This alert appears when I run cron. I believe that, this also affects search indexing. I re-indexed my site. There are 7000 nodes. Each time I run cron, 500 items are indexed. It went well for first 5000 items. There was no error. Then for the last 2000 nodes, this error appeared on the "status report" page after I run cron. Remaining 2000 nodes arent indexed.

Sinan Erdem’s picture

When I look at the logs, I also see this error when I run cron:

EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7539 of /home/administrator/metalface/includes/common.inc).

Aron Novak’s picture

693 bytes
PASSED: [[SimpleTest]]: [MySQL] 40 pass(es). View

Try this.

wozzz7’s picture

This patch worked for me

aaron.r.carlton’s picture

Status: Needs review » Reviewed & tested by the community

I manually applied this patch to the 7.x-2.1 branch and it has appeared to fix the issue. It would be nice to get this into the next release.

charlie-s’s picture

Also solid and working for me.

Alex Andrascu’s picture

Assigned: Unassigned » Alex Andrascu
Issue summary: View changes

Ok let's get it in then

newswatch’s picture

I tried both patches. Neither worked.

John Franklin’s picture

The patch in #9 doesn't seem to catch all cases of an unset $item['access']. Here is a patch that covers all the instances in the node_references.module file.

Ramdas Gaikar’s picture


Can someone commit the changes done here so that it will be available in new release?


RenatoG’s picture

Issue tags: +ciandt-contrib

Yes, @ramdas-gaikar.

We will commit and will be available in the next release.


  • RenatoG committed d8567b3 on 7.x-2.x authored by mh86
    Issue #1249268 by mh86, John Franklin, Aron Novak, chalee, Sinan Erdem,...
RenatoG’s picture

Status: Reviewed & tested by the community » Fixed


Thank you very much for contribution people.

Commited in dev branch.

Good Work and Good Weekend.


Status: Fixed » Closed (fixed)

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