I get the following error:
EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7879 of /var/www/dealersrvcs/docroot/includes/common.inc).
Upon further review through xdebug, it came down to this line of code in /quiz/question_types/quiz_question/quiz_question.module: 215
$type = 'node';
drupal_alter(array('node_view', 'entity_view'), $node->content, $type);
I changed the first line to $type = $node->type and everything works perfect. Not sure why $type is set to 'node'. This gives the entity malformed exception as stated above for missing property on entity of type node.
For viewing the results I also made similar change to this file: /quiz/question_types/quiz_question/quiz_question.core.inc: 729
$type = 'node';
Changed it to $type = $node->type and now everthing works fine.
This seems to be a bug in the code. Can someone confirm this?
Thanks
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | wsod_when_trying_to-2594511-13.patch | 2.84 KB | djdevin |
Comments
Comment #2
Poieo commentedI can confirm the same issue after updating from Alpha10 and the mentioned changes do resolve the issue.
Comment #3
michellezeedru commentedConfirmed, the changes above resolved the issue for me. Thank you so much for sharing a solution!
Comment #4
djdevinI'm not sure what's going on here...
If you look at node_view(): https://api.drupal.org/api/drupal/modules!node!node.module/function/node...
Above is from node.module, but we have the exact same code in Quiz because we have to render the question node in a special way but let it be altered.
This doesn't fail in the tests so is it possible there's a contrib doing something bad? I haven't been able to reproduce and we usually run about 150+ active modules in our distro.
Comment #5
Poieo commentedI can confirm the error goes away after disabling most of my contrib modules. Now I just need to go back and figure out which one is causing it.
Comment #6
Poieo commentedI narrowed it down to elFinder 7.x-2.x-dev. Disabling that modules resolves the issue. Seems like a strange culprit. Was anyone else with this error using that module as well?
Comment #7
markusa commentedI see this error as well, and the "fix" described makes it work for me.
I don't have elFinder installed, but many modules, several of those are completely custom
using Quiz 5.x-beta2
Comment #8
markusa commentedthe fix is not a fix at all, and will cause problems with the EVA and Display Suite, two name two big ones...
There has to be something else...
Comment #9
markusa commentedSo it was the EVA module breaking Quiz, or Quiz is not quite right to work with EVA, depending on your point of view.
The build array that is produced for a quiz question and passed around to hook_entity_view_alter() implementations does not include the entity object in an index '#entity', as is semi-standard for entity build arrays.
This above issue basically make the EVA module completely unusable.
Any other hook_entity_view_alter() implementation that is expecting an '#entity' parameter and tries to find say the entity_id and use the entity api, will break, unless they take into consideration.
Comment #10
markusa commentedThis small adjustment is working for me here:
/quiz/question_types/quiz_question/quiz_question.module: 215
and here:
/quiz/question_types/quiz_question/quiz_question.core.inc: 729
I think this small alteration will insure compatibility with hook_node_view and hook_entity_view implementations
Comment #11
markusa commentedwell that's not quite the end solution, because
'question' => $node->content,
is used later and doesn't seem to have the benefit of something update from a alter hook implementation
getting close though
Comment #12
bletch commentedI can confirm this as well. I do not have EVA or elFinder but do have a number of contrib modules, all of which are needed.
#10 kind of worked, the question text did not appear, so am using the original solution for now - which works fine.
Comment #13
djdevinOkay, here it is.
We can use node_view() as long as we unset #theme so the node template doesn't fire. This was already happening before since we did not add the '#theme' or 'node' elements to the build.
This fixes issues with EVA or anything else that alters node/entity views.
Comment #14
djdevinFixed. Thanks!
Comment #16
markusa commentedyep this patch fixes it! Thanks!