This module doesn't seem to support views that have relationships? It works fine with a view without relationships but keeps throwing an error:
EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7644 of /var/www/drupal-7.20/includes/common.inc).
I chased the above down to views_megarow/includes/views/handlers/views_handler_field_megarow_links.inc render() function where the $entities[1] is not set accordingly (it is an empty array).
I would appreciate some assistance with this, thanks.
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | views_megarow_add_support_for_relationships-2198783-15.patch | 2.21 KB | Mouna Hammami |
| #14 | add_support_for_relationships-2198783-14.patch | 2.56 KB | bohemier |
| #10 | Screen Shot 2014-08-04 at 2.10.01 PM.png | 180.32 KB | monaw |
Comments
Comment #1
artusamakHi, please check the rest of your code an configuration, i test to build a view listing nodes with a relation on the author displaying its email in the megarow and i'm able to open megarows.
Comment #2
monaw commentedI just upgraded to Megarow 1.3 so it is a clean install of the module and I am getting the same error:
EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7721 of /drupal/includes/common.inc).
Caused by the same problem in views_megarow/includes/views/handlers/views_handler_field_megarow_links.inc render function $entities[1] is empty.
Please help...
Comment #3
monaw commentedComment #4
monaw commentedI added the following code to render():
right above:
$entity = reset($entities[1]);and that made the run-time error go away.
However, obviously the $values->_field_data['field_log_client_node_nid'] is specific to my content type but that did work for me.
Comment #5
monaw commented@ Artusamak : FYI, my megarow field is a content link, not an user link; can you do your test on a content link?
Comment #6
monaw commentedSame bug for 1.2 and 1.3...
Comment #7
monaw commentedIn case this is important, my relationships are nested...user->customer->log
Comment #8
monaw commentedOk, I figured out what the problem is...
In addition to the hack I did above and in https://drupal.org/node/2198833, I also had to hack views_megarow_preprocess_views_view_table() function by adding:
$result_entities[0] = "node";I noticed that $result_entities[0] is set to "user" and because my relationship is not user but content, I made the hack above and that got my megarow working! Obviously this works for my case but is not correct to handle general cases.
I think this is a serious bug in the module that needs to be patched as soon as possible.
Comment #9
artusamakCould you screenshot your views config because i can't reproduce your issue.
Comment #10
monaw commentedAttached is my views configuration page screen shot...let me know if you need anything else.
Comment #11
pq commentedHi,
This error can be reproduced by trying to setup views_megarow on a Shopping cart summary view as provided by Drupal commerce. These are the steps I just tested with:
This returns the following error:
Comment #12
nwom commentedHaving the same issue on a Taxonomy Term view. I have a relationship configured for "nodes attached to term".
When attempting to use megarow, the same error as mentioned above appears.
Comment #13
bohemier commentedHi Artusamak,
To reproduce this, you simply need to create a view with only fields from a relationship. For instance, Article has an entity reference on a node. Have the first field display the title of that referenced node. Views_megarow will try to get the entity from the BASE table only. So this issue lies when calling query->get_result_entities. By default, when not specifying the second argument, it will fetch the entities from the base table. You can pass a second argument to this function to get entities from a relationship instead... For example:
query->get_result_entities($vars['view']->result, <strong>'field_article_ref_node'</strong>);See
- includes/views/handlers/views_handler_field_megarow_links.inc, function render()
- views_megarow.module, function views_megarow_preprocess_views_view_table()
I think to support this, we would need to configure the megarow settings page and add a relationship selection there. This screen would fetch all relationships from the view, and offer the user to pick which one to base the megarow links upon.
Although this is somewhat of a feature request, the module still has a bug when not using any fields from the base table.
Comment #14
bohemier commentedRolling out a first patch that adds support for relationships. Things are not perfect yet... this patch will:
- Use the relationship identified in the Megarow links field as the relationship for getting the base entities to render links.
- Use the relationship identified in the FIRST Megarow links field as the relationship for getting the base entities to output the row classes.
This will work as long as the relationship has the same entity type as the view's base table. (eg: An article pointing to another article in an entity reference).
What needs to be done from here:
- Support other entity types than the base table. (eg: An article pointing to a taxonomy term in an entity reference).
- Fix the bug that displays an error message when no entity field can be fetched in the view (see original bug report)
- Allow Megarow links field to have a relationship with other types of entities then the base table.
Comment #15
Mouna Hammami commentedHi,
Thanks for this patch it works fine form me. but i improve it to avoid geting errors ifthere no relationship for link_megarow field
Comment #16
derekw commented#15 fixed my Views Megarow problem.
Comment #17
andrii momotov commentedD7 reached its EOL back in January 2025, and there is no active release for D7 for this module anymore.
Development or support is not planned for D7. All D7-related issues are marked as outdated in a bunch.
Everyone can apply the patches above (not tested by the maintainers, tested by the community) to their D7 projects.
If the issue remains relevant for D10+ versions, merge requests with proposed solutions for a new module version (D10+) are welcome in a new follow-up issue.
Thanks!