In the context related to a VBO action, we have no information related to the view.


Status:Needs work» Needs review
new1.38 KB

I've added in the context the name and the current display of the view.

Why would you need it? What's your use case?

I 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.

This 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 ....

That 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.

How 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.

When 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)

Issue summary:View changes
new3.72 KB

Initial untested reroll / rework, with complete information needed to reconstruct the view.

Status:Needs review» Fixed

Status:Fixed» Closed (fixed)

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