I'd like to have more control over where the operations are displayed. Views already provides this feature as "exposed form in block" for filters. How would one go about adding that option for views bulk operations? Does that sound like something that is possible (aside from whether or not the maintainers have the time or intention to actually implement it)? If so, can anyone provide some hints on where to start looking in the code?
Thanks.
Colin
Comments
Comment #1
bojanz commentedUnfortunately, this is not possible because of the way Views Form works.
When you have an exposed form in a block, it's rendered separately from the view. It gets submitted, and the view takes the new values, filters the query.
The problem with the VBO form is that other than the value of the operations dropdown, you also need the values of the checkboxes when submitting everything.
So you can take the operations display and pull it out of the form, but when you submit it, you won't know which rows were selected.
Comment #2
colin_young commentedHmm. So then would it be possible to target the operations controls to render in a specific region in a theme? I suspect no, for similar reasons (i.e. that the form probably won't encompass that region). Otherwise I'm looking at shuffling things around with JQuery, which isn't all that difficult, but it feels like a hack (actually I really only need to hide the operations, and then add a link that clicks the hidden operation button).
As an aside, there really needs to be a "closed (can't fix option)" for status...
Comment #3
bojanz commentedYeah, I had the same thought.
Yes, I suspect so as well. You just can't separate the two parts of the form (operations and selection)
JS hackery seems like the best solution. And connecting a link with a hidden button is not even that hacky.
Comment #4
colin_young commentedDepends on your definition of "hacky" :)
I'm thinking that I'm going to go ahead and hack it together tonight, then think about "blockifying" it and seeing if I can't come up with some way to cleanly integrate the JQuery solution with VBO.
Comment #5
alexverb commentedWouldn't it be possible to display the VBO operations form in the header or footer of the view display? That way you would still have some control through Display Suite on how to layout the view. And without DS you could then still choose to render it on top or bottom of your view.
Comment #6
colin_young commentedThat might be possible, but in my case I need to put my forms into a completely different region in my theme, quite outside of the views rendered area.
I did end up with the JQuery solution, and once I wrap up my current project, I've got a list of all the patches, hacks and custom code I needed to write and use that I need to go through and figure out how they all need to be contributed back.
Comment #7
nwom commented@colin_young Could you perhaps contribute your changes that you made? It would be great to expose VBO in a block rather than directly in the view.