The error message:

# Notice: Undefined index: node in galleria_field_formatter_prepare_view() (line 417 of .../sites/all/modules/contrib/galleria/galleria.module).
# EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7409 of /.../includes/common.inc).

Construction:
each image is a content of content type "oeuvre"
each gallery is a content of content type "gallery" wich have a node-reference (with node reference 7.x-2.0) to node of content type "oeuvres",number of values illimited, and the display is set to "galleria".

The galleria module worked perfectly but suddenly break down.

don't know why
I try to install entity reference insted of reference, but I can't set the display to galleria with this module

Can you explain me the error?

Comments

kroimon’s picture

Title: Galleria doesn't find images node index » Undefined index: node in galleria_field_formatter_prepare_view() line 417

If it worked before, try to find out what you changed ;-)

I don't know what causes this error...
What is the type of the image field in content type "oevre"? Is it a standard "image" or "media" field?

We currently only support the references module but we should investigate the new entity reference module.

jthorson’s picture

I got the same on 7.x-1.x-dev, using standard 'image' fields.

jthorson’s picture

More info:

Running 7.x-1.x, and References 7.x-2.0.

The line that throws the error is the $nodes[$item['nid']] = $item['node']; assignment below:

function galleria_field_formatter_prepare_view($entity_type, $entities, $field, $instances, $langcode, &$items, $displays) {
  if ($field['type'] == 'node_reference') {
    $nodes = array();
    foreach ($items as $entity_items) {
      foreach ($entity_items as $item) {
        $nodes[$item['nid']] = $item['node'];
      }
    }
    field_attach_load('node', $nodes);
    field_attach_prepare_view('node', $nodes, 'default', $langcode);
  }
}

This is because each $item has only two components to the array: one keyed 'nid', and one keyed 'access'. There is no 'node' key.

Unfortunately, I don't know the field system well enough to know what *should* be in there ... but would appreciate a nudge in the right direction.

evronique’s picture

I success to repare my slideshow with galleria:
I just define $item['node'] with:
$item['node']=node_load($item['nid']);
in function galleria_field_formatter_prepare_view line 412 and function galleria_field_formatter_view line 431.
but that's not a really good way to hack the module.
If you have some suggestions...

kroimon’s picture

To my understanding, the node_reference module should already have loaded the node in node_reference_field_formatter_prepare_view() before galleria_field_formatter_prepare_view() gets called. I have no idea why that fails for you.
Maybe you could try to debug that. Just do some debug output in node_reference_field_formatter_prepare_view() and find out whether and when it gets called.

As a workaround, I could add a

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

to the function, but I feel like that's not the right way to do that :-/

kroimon’s picture

Status: Active » Fixed

I hopefully finally found and fixed this bug today.
The changes should be in the next -dev build. Please reopen this issue if you find any bugs!

Status: Fixed » Closed (fixed)

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