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.

Comments

artusamak’s picture

Category: Bug report » Support request
Status: Active » Closed (cannot reproduce)

Hi, 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.

monaw’s picture

Status: Closed (cannot reproduce) » Active

I 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...

monaw’s picture

Category: Support request » Bug report
monaw’s picture

I added the following code to render():

if ( empty ( $entities[1] ) &&
        isset ( $values->_field_data['field_log_client_node_nid'] ) )
        $entities[1][] =
            $values->_field_data['field_log_client_node_nid']['entity'];

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.

monaw’s picture

@ Artusamak : FYI, my megarow field is a content link, not an user link; can you do your test on a content link?

monaw’s picture

Version: 7.x-1.2 » 7.x-1.3

Same bug for 1.2 and 1.3...

monaw’s picture

In case this is important, my relationships are nested...user->customer->log

monaw’s picture

Ok, 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.

artusamak’s picture

Category: Bug report » Support request
Status: Active » Needs work

Could you screenshot your views config because i can't reproduce your issue.

monaw’s picture

StatusFileSize
new180.32 KB

Attached is my views configuration page screen shot...let me know if you need anything else.

pq’s picture

Hi,

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:

  • Set up a clean Drupal install
  • Install commerce and views_megarow
  • Install all the required commerce related modules so that you can get a product and order and checkout
  • Create a product and product display
  • Add the product to your cart
  • Install views_ui
  • Go to your cart and checkout
  • Edit the cart summary view
  • Change the display format to "Megarow table" - leave all settings on defaults
  • Add a Mega row links field (either for order or line item, the result is the same) - leave all settings on defaults
  • add links - I was testing with just "test|node"
  • Save and view the checkout page again

This returns the following error:

EntityMalformedException: Missing bundle property on entity of type commerce_line_item. in entity_extract_ids() (line 7766 of [redacted]/includes/common.inc).

nwom’s picture

Version: 7.x-1.3 » 7.x-1.x-dev
Category: Support request » Bug report

Having 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.

bohemier’s picture

Hi 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.

bohemier’s picture

Title: Doesn't seem to support relationships » Add support for relationships
Issue tags: +views relationships
StatusFileSize
new2.56 KB

Rolling 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.

Mouna Hammami’s picture

Hi,
Thanks for this patch it works fine form me. but i improve it to avoid geting errors ifthere no relationship for link_megarow field

derekw’s picture

#15 fixed my Views Megarow problem.

andrii momotov’s picture

Status: Needs work » Closed (outdated)

D7 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!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.