3

I am trying to use the Rules action called "Load a list of entity objects from a VBO View." I had it working before, but I've since refreshed my DB from prod and I can't remember what my views looked like. I stripped the setup down to its most basic, vanilla configuration and I still can't get it to work.

Here's what I've done:

I created a view of Users. No page; no blocks; just a master display of users with no filter. Two fields: the user's name and the Bulk Operations checkbox (no actions; everything default).

I then created a rule. The event is just "view content" so I can iterate quickly. For the action, I selected "Load a list of entity objects from a VBO View." When I view a node (which triggers the rule), an error message pops up in the log that says, "Unable to get a data value. Error: Invalid data value given. Be sure it matches the required data type and format."

The reason is that the function views_bulk_operations_action_load_list() is trying to make an entity_metadata_wrapper out of FALSE. The exact line is views_bulk_operations.rules.inc:176:

$entities[] = entity_metadata_wrapper($entity_type, $vbo->get_value($result)); // $entity_type == 'user'

$vbo->get_value($result) ends up FALSE because $vbo->entities is NULL. Where are the entities? Did I miss something obvious when I set up my view?

4 Answers 4

0

This issue has been reported and addressed on Drupal.org: https://www.drupal.org/node/2853029

The latest dev version has been updated to address this issue (version 7.x-3.x-dev).

0

I've identified the exact problem. I don't know if this will help others, as mine is a pretty obscure case, but I will post it just in case.

The site is using Open Atrium, which contains views_bulk_operations, but we had also created a separate copy of views_bulk_operations, patched it, and placed it in our own sites/all/modules directory. As far as I can tell, having two copies of it breaks the PHP class inheritance chain somehow. Specifically, in views_bulk_operations.rules.inc:176:

$entities[] = entity_metadata_wrapper($entity_type, $vbo->get_value($result));

$vbo is an instance of views_bulk_operations_handler_field_operations, which extends views_handler_field_entity, which in turn extends views_handler_field. In a properly functioning site, the line above calls views_handler_field::get_value(), but in my borked up site it calls views_handler_field_entity::get_value(). Not sure what the permanent fix will be, but removing our patched copy of VBO did get it working again.

0

You want to pass the userid as a parameter also, similar to what is shown around 7:30 in the video about Using VBO to load list of objects into Rules. Here is a summary of what is shown in this video:

  • You need a view that lists the entities you want to work on in Rules. Note that you don't need a display of the view – and it might even be better not to have one if you don't want the view to be displayed somewhere.
  • However, you need one bulk operations field. The type of bulk operations field determines what entity type will be sent to Rules. Note that you don't need any actions enabled for the field – it is enough that it is present.
  • You need a rule that, as an action, loads entities from a VBO. (This is available under the "Views bulk operations" group.) All view displayes with at least one VBO field will be selectable.
  • The action provides a list of entities, that can be used just like other lists in Rules. Combine with loops, actions and Rules Scheduler to make awesomeness happen.
0

Make sure that the VBO field is loaded in the Master display. In the Views module settings, it is possible to force this Master display.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.