Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
In the context related to a VBO action, we have no information related to the view.
Comment | File | Size | Author |
---|---|---|---|
#8 | 1548790-8-pass-views-info.patch | 3.72 KB | bojanz |
#1 | 1548790_adding_view_name_and_display.patch | 1.38 KB | rosinegrean |
Comments
Comment #1
rosinegrean CreditAttribution: rosinegrean commentedI've added in the context the name and the current display of the view.
Comment #2
bojanz CreditAttribution: bojanz commentedWhy would you need it? What's your use case?
Comment #3
rosinegrean CreditAttribution: rosinegrean commentedI have an export action. The mapping of the fields depend on the view and the display you are on.
If I try to export more than 10 items, it launches in batch and I loose all the information related to the current view. This was the only way to solve the problem.
Comment #4
damiankloip CreditAttribution: damiankloip commentedThis is one for @bojanz to make the decision on really, I can see how this may be useful in some cases, like yours. However, you are just passing in the view name and display as that's all you need in your case. I think if this was going to be passed, it makes sense to make pass the whole views object? Not sure ....
Comment #5
rosinegrean CreditAttribution: rosinegrean commentedThat was my first attempt, to send the view object, but for some reason I couldn't. That's why I've sent only the view name and current display.
Maybe this problem can be solved in another way: to send this information in the context of the action. It's impossible to do this with the current implementation of VBO. I think it's better to review this aspect first.
Comment #6
matiaslezin CreditAttribution: matiaslezin commentedHow do I send the view information through the context to the action? I've read in the VBO module page that:
$context['rows'] has an array of selected rows in the form of $row_index => $views_row.
Can anyone enlighten this a little bit more? Maybe with an example. I want to get the node id, for instance.
Comment #7
kenorb CreditAttribution: kenorb commentedWhen exporting entities, it would be good to know which fields are added in the view it-self.
See: #1436726: Add integrations with Views Bulk Operations (sample VBO action to expose selected records to CSV export included herein)
Comment #8
bojanz CreditAttribution: bojanz commentedInitial untested reroll / rework, with complete information needed to reconstruct the view.
Comment #9
bojanz CreditAttribution: bojanz commentedTested, committed with some doc changes:
http://drupalcode.org/project/views_bulk_operations.git/commitdiff/3c438...