Within views_bulk_operations_action_load_list(), a call is made to views_bulk_operations_handler_field_operations::getValue(). However, views_bulk_operations_handler_field_operations now extends views_handler_field_entity, and views_handler_field_entity::getValue() behaves differently than views_handler_field::getValue(). This difference causes views_bulk_operations_action_load_list() to error out.

CommentFileSizeAuthor
#8 2853029-8.patch848 bytesjoelpittet
#2 2853029-01.patch889 bytespjohn
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pjohn created an issue. See original summary.

pjohn’s picture

FileSize
889 bytes

I made this patch based on the strategy that was used in views_bulk_operations.drush.inc. See if it addresses the problem.

joelpittet’s picture

Do you happen to know when that handler's getValue() changed output? or did it?

pjohn’s picture

joelpittet, I don't think the issue is that getValue() changed. It's that views_bulk_operations_handler_field_operations used to extend views_handler_field, but now it extends views_handler_field_entity. views_handler_field_entity::getValue() works differently than views_handler_field::getValue(), and I suspect maybe the developers missed one spot where that change had to be accounted for.

joelpittet’s picture

I know there is no automated tests for VBO but could you tell me the steps to reproduce in the simpliest case and I'll do that manually and step through to ensure the change fixes the issue. Then commit it.

joelpittet’s picture

Status: Needs review » Postponed (maintainer needs more info)
pjohn’s picture

Steps to reproduce:

  1. Create a new content view titled "Test VBO Patch" (machine name test_vbo_patch). Give the view a page display and format as a table of fields.
  2. Add the field "Bulk operations: Content" and save the view.
  3. Install Devel and visit the "Execute PHP Code" page (devel/php). Enter the following code:
require_once(drupal_get_path('module', 'views_bulk_operations') . '/' . 'views_bulk_operations.rules.inc');
$list = views_bulk_operations_action_load_list('test_vbo_patch|page', '');
dpm($list);

If the patch works, the script will execute and display an array containing an EntityListWrapper. It should fail the way the module currently is.

joelpittet’s picture

Status: Postponed (maintainer needs more info) » Needs review
FileSize
848 bytes

Thanks @pjohn, that looks like the original intent is to get the entity to avoid loading a new one from the ID and having a double database hit. How about we do that as a fallback?

joelpittet’s picture

Will this do the trick?

tobiasb’s picture

For me the trick does it.

joelpittet’s picture

Feel free to set the status to RTBC and I'll commit this to -dev

nairb’s picture

Status: Needs review » Reviewed & tested by the community

Works for me too. Thanks!

  • joelpittet committed e9419f5 on 7.x-3.x
    Issue #2853029 by joelpittet, pjohn, tobiasb, nairb:...
joelpittet’s picture

Status: Reviewed & tested by the community » Fixed

Thank you, I've committed this to the -dev branch.

tobiasb’s picture

I believe the root problem is, when you do not have declare the 'entity type' in hook_views_data().

VBO do not provide anymore the field in views -> you can not see the view anymore in select list in rules.

And you got a Fatal error:

Fatal error: Call to a member function get_entity_type() on a non-object in /var/www/html/web/sites/all/modules/contrib/views_bulk_operations/views_bulk_operations.rules.inc on line 173

when you define the type, then all is fine. Views/Rules works again.

$data['myentity']['table']['entity type'] = 'myentity';
joelpittet’s picture

@tobiasb if that is something you are still getting can you open a new issue with the steps to reproduce?

pjohn’s picture

Thanks @joelpittet; I haven't checked this thread in a few days, but I like your solution.

Status: Fixed » Closed (fixed)

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

joelpittet’s picture

marco.b’s picture

After updating to the current dev version = "7.x-3.4+9-dev" all works fine. As this is a major bug I strongly recommend to include the fix into a new stable version as soon as possible.

RedEight’s picture

Would like to see this in a stable release. I was very confused when the entity id fetch in rules worked but the entity fetch was not.

joelpittet’s picture

Waiting for a resolution to this #2856944: 'Please select at least one item' - after upgrading to 7.x-3.4 before a new release but I'll create a new release and let them sort that out. Please help if you can.

drunkencelt’s picture

HI,
I'm afraid the commit at #13 which is included in 7.x-3.4+9-dev has not solved my problem. (Core 7.54, Rules 7.x-2.10, Views 7.x-3.16)

I still do not get a list of VBO views showing in the drop-down field in either of the actions 'Load a list of entity ids from a VBO View' or 'Load a list of entity objects from a VBO View' when using 7.x-3.4+9-dev or 7.x-3.4.

If I revert to 7.x-3.3 I get all my VBO views showing up in the drop-down but no values are returned by either action similar to #2862858: Rule action "Load a list of entity IDs from a VBO view" returns list with empty values.

In issue #2862858, patch #7 reportedly fixes the view list drop-down issue for the views_bulk_operations_action_load_id_list (it doesn't for me) and refers to the patch on this thread to resolve the same issue for views_bulk_operations_action_load_list (now included in 7.x-3.4+9-dev, but again this does not work for me).

Not quite sure what is going on here as on each occasion I make sure the modules are installed/reinstalled and clear caches numerous times. I also delete and recreate the VBO field in my test view just in case the VBO field isn't working properly between changes.

Not sure if this helps anyone to figure it out. The only thing left for me to try is to revert back to 7.x-3.3 and Views 3.15 as everything was working properly when I set it all up a good few months back.

joelpittet’s picture

Can you open a new issue for your problem @drunkencelt? I think your issue is related to this one, so please apply the patch against -dev
#2856944: 'Please select at least one item' - after upgrading to 7.x-3.4

I'd like to roll out another release to fix this one soon.

webservant316’s picture

when is the new release due?

joelpittet’s picture

Hopefully after the issue I mentioned in #24 is reviewed and tested.

adrianavaz’s picture

Hi,

I was having this problem too. Patch #8 worked for me.

Thanks

jweirather’s picture

Same issue here, I used drush to update to the dev version, issue resolved. Thanks all.

maxplus’s picture

Thanks,
Patched current 3.4 and it works again for me!

butterwise’s picture

FWIW, upgrading to latest dev resolved this problem for me, as well.