This is related to #2853029: views_bulk_operations_action_load_list not working. Patch #8 (committed to the the dev version) fixed the issue with the action "Load a list of entity objects" but I'm finding the the list contains empty values when using the action "Load a list of entity IDs". [EDIT] Just to clarify, the list contains the correct number of items, but the values are empty.
| Comment | File | Size | Author |
|---|---|---|---|
| #25 | interdiff_7-24.txt | 831 bytes | izmeez |
| #24 | load_list_of_ids_updated-2862858-24-D7.patch | 673 bytes | codeyourdream |
| #7 | load_list_of_ids-2862858-7-D7.patch | 672 bytes | argiepiano |
Comments
Comment #2
argiepiano commentedComment #3
argiepiano commentedComment #4
argiepiano commentedComment #5
joelpittetThis needs steps to reproduce the error, otherwise others can't help.
Comment #6
argiepiano commentedSteps to reproduce problem:
1. Create a bunch of nodes
2. Create a view of content to show those nodes. Be sure to include a "Bulk operations: Content" field
3. Create a rule component that contains the action "Load a list of entity ids from a VBO View." Select the view you created in 2.
4. In the rule, loop through the list and use each item to do something, for example, "Show a message on the site" and use the variable produced by the loop to show its value (e.g. The value of this item is: [list-item:value] )
5. Execute the component
You will get a bunch of messages (as many as there are items in the view), BUT instead of showing the ID of each, you get an empty value for each of the items.
Comment #7
argiepiano commentedPatch attached. Works fine in my case. Please test.
Comment #8
argiepiano commentedComment #9
joelpittetThanks for the steps, I think this may be related to #1334374: Re-use generic entity views table from the code they both touch.
Comment #10
joelpittetThank you for the patch, the code is supposed to produce an array of entity IDs. There is totally a bug if it's tossing entity objects in the list.
We could get the id of the entity, I'm going to test the steps
Comment #11
argiepiano commented@joelpittet, something changed in Views version 3.15 that affected the VBO line:
$ids[] = $vbo->get_value($result);Keep in mind that this line was present and was working fine in VBO version 7.x-3.3 when combined with Views 7-x.3.14.
The name of the variable I used in the patch
$entityis misleading and wrong. The function$vbo->get_value($result)never "tossed entity objects". In fact this function always tossed entity IDs. The patch that I created basically falls back to this line if the user is still using Views 3.14. I should have used a different variable name.Comment #12
nixar commentedThe patch in #7 does seem to fix views_bulk_operations_action_load_id_list
However a similar problem exists for views_bulk_operations_action_load_list and this patch fixes the issue in this case.
I hope we can get a fix for the root of this since it was working fine a version ago.
Comment #13
maxplus commentedThanks @nixar
I'm also using the current dev version (including patch from https://www.drupal.org/node/2853029#comment-11949835) together with patch #7 from this issue.
Now both my "Load a list of entity IDs from a VBO view" an "Load a list of entity objects from a VBO view" are working again
Comment #14
alisonYAAAAAAASSSSSSS omg that was an incredibly painful few hours, wrapped up nicely when I finally came across this issue :) I concur with @maxplus -- using the latest -dev along with the patch at #7 fixed my VBO-dependent rules. (I'd found #2853029: views_bulk_operations_action_load_list not working before, but it didn't help me, and I figured, dammit it's just me... But no!)
FWIW -- same here re: "the list contains the correct number of items, but the values are empty"
THANK YOU @argiepiano -- and @maxplus!
Comment #15
kcannick commented@alisonjo2786 Does this only fix Loading list of IDs or loading list of entities as well?
Comment #16
argiepiano commented@Kcannick the patch here only fixes the issue of ids being empty. To fix list of entity load see comments #12 and #13
Comment #17
nithinkolekar commentedwhat if base entity is of type User and need to get nid?
With some relationship added to content type like Article and field "Bulk operations: Content" with having relationship added, getting following error
Notice: Undefined property: stdClass::$nid in views_bulk_operations_action_load_id_list() (line 207 of /mysite/public/sites/all/modules/views_bulk_operations/views_bulk_operations.rules.inc).if this expected behavior? (even with applied patch #7)
Comment #18
apmsooner commentedpatch in #7 fixes my issue.
Comment #19
kcannick commentedPatch in #7 fixed my issue as well. When will this be committed?
Comment #20
sano commented#7 works for me as well. Thanks
Comment #21
alansaviolobo commentedworks for me
Comment #22
othermachines commentedI have a rule that iterates over a VBO view to send out emails to users and at some point this stopped working. I've traced the problem to this issue, and patch in #7 fixes it. Here's the rules debug info:
Before patch:
After:
Thanks!
Comment #23
chris matthews commentedComment #24
codeyourdream commentedThe patch from #7 has the similar issue that is described in #2960424: Load a list of entity objects from a VBO View not working: loading IDs doesn't work when a field with identifier is not from a View's base table.
Attached is the updated patch.
Comment #25
izmeez commentedAn interdiff might help illustrate the single line change in the patch. Here it is.
Comment #26
othermachines commentedJust noting that #7 still applies cleanly against latest dev. The new patch in #24 makes sense, but unfortunately I am unable to test it at the moment.