Posted by gunzip on June 5, 2009 at 10:11am
Jump to:
| Project: | Views Bulk Operations (VBO) |
| Version: | 6.x-1.x-dev |
| Component: | Miscellaneous |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
hello, i'm writing a custom action. i need to obtain from the view the current row/values being processed
into the mymodule_action hook (i wonder if this is possible through the variable $context->view)
i know i can get a single object loaded with my custom load function but what i need are the values in the current row, not some object (node, user) property.
thank you in advance!
Comments
#1
Yes, the $context->view->result array should contain the row values. Two caveats:
* You will need to manually find the entry in $context->view->result that corresponds to the object passed to the action.
* In case of a global selection (across all view pages), the $context->view->result will not contain all results, only those for a single page.
Hope that helps. Feel free to produce patches that fix those caveats :-)
#2
I ended up calling the view again and getting the results in my custom action with pagination off.
The issue is that, when in batch mode, the view object passed in the context is:
public '__PHP_Incomplete_Class_Name' => string 'view' (length=4)
so i cannot use it anyway. Any hint ? =)
#3
That was a bug! Thanks for reporting it. I committed a fix, so please try it in the latest dev (12 hours from now).
#4
ok now I can get the row result but there's an issue: if I have 3 different rows that come from the same node
(ie. the same cck field repeated into the same node with different values) the action is called only once
because the nid is still the same. is there a way to overcome this ?
#5
(ok i solved this cycling on results)
#6
Fixed in the latest release. The row is passed to the action in
$context['row']. Concerning the nid being the same for multiple rows, I've opened a separate issue for this: #735596: VBO doesn't preserve duplicate results#7
Automatically closed -- issue fixed for 2 weeks with no activity.