Using Peekaboo 7.x-2.0-beta1 with both References 7.x-2.0 and 7.x-2.x-dev (2012-Jan-06).
Trying to view a node where there is a node_reference field with a node being referenced, I get the following error:
EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7410 of includes/common.inc).
If there is no content in the field, the error does not occur.
Also, if the same value is exposed through Views actively using Peekaboo, Peekaboo seems to function as expected.
I'm not entirely sure whether this issue is being caused by Peekaboo, as the Field Formatter options for the Node Reference field within Node Display can be set to either `Peekaboo: Disabled` OR `Peekaboo: Enabled` and the error still occurs. If I set the display formatter to either `Node ID` or `Hidden` the error does not occur.
Running `debug_backtrace()` immediately before the error in `common.inc` reveals that the code is passing through `peekaboo_field_formatter_view()` regardless.
Comments
Comment #1
carn1x commentedAfter digging through the code a bit more I realize that Peekaboo is very unlikely responsible.
Comment #2
arkz commentedAfter installing Peekaboo 7.x-2.0-beta1, I'm receiving similar errors (without even enabling it for any fields). The errors go away when I disable Peekaboo, so I guess this module is causing it, or perhaps another module not playing nicely with it.
From my limited digging it looks like it's stemming from line 287 in peekaboo.module:
return module_invoke($display['settings']['peekaboo_module'], 'field_formatter_view', $entity_type, $entity, $field, $instance, $langcode, $items, $display);but I don't know enough about Drupal to know what the problem is. Hopefully this will help.
Comment #3
arkz commentedComment #4
danielb commentedDid you try clearing your cache under 'performance' ?
I wonder if we need to implement hook_formatter_prepare_view()
Comment #5
danielb commentedYeah that's what it was, I've added that function. Not sure I did it perfectly cos it's kind of an awkward hook.
Comment #6
arkz commentedUnfortunately it doesn't seem to have solved the problem, and added a new error as well.
Warning: Parameter 6 to taxonomy_field_formatter_prepare_view() expected to be a reference, value given in call_user_func_array() (line 794 of C:\xampp\htdocs\drupaltest\includes\module.inc)I'm sure you understand the issue better than me but I'll write what I've found in case it helps:
I only get the error on taxonomy reference fields, and it seems to be because the
$itemsarray is only passing through thetidvalue for each item, whereas thetaxonomy_field_formatter_viewfunction expects ataxonomy_termaswell.As a quick hack, the following code (entered just above the
module_invokecall on line 287), as well as removing theformatter_prepare_viewhook, fixes the issue for me.But unfortunately I wouldn't know where to begin on fixing the underlying problem.
By the way, is it just me getting this issue? I'm starting to think my bloated development environment may be causing problems, as I'm now getting a
_form_validate()error upon enabling Peekaboo for a field. Guess I'll try it on a cleaner install when I get time.Comment #7
danielb commentedClear your cache ?
Nah that wouldn't be it, since it sounds like the hook executes for you.
How come it worked fine for me, then?
Comment #8
danielb commentedTry this
change this function
to this:
The awkward thing I mentioned before is that getting the module's name from $field['module'] is inconsistent with the rest of the peekaboo module which gets the module name from the display settings. But this function acts on multiple entities and stuff, so umm.. what :(
Comment #9
arkz commentedThat did the trick. Excellent - thanks! Great module by the way :)
Comment #10
danielb commentedAh ok yeah the reason was that module_invoke() sucks balls.
Comment #11
danielb commentedComment #12
carn1x commentedawesome thanks :D