Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I wanted to get rid of the fieldset around operations. In order to do this I needed to form_alter the same as what VBO does, and set the module weight below VBO's. This is a bit odd. It would be better if views_bulk_operations_form were alterable directly.
Just a minor feature request. I will write a patch for this and submit it later.
Comment | File | Size | Author |
---|---|---|---|
#13 | 1286718-vbo-form-alter.patch | 1.95 KB | bojanz |
#12 | 1286718.patch | 1.22 KB | damiankloip |
#11 | 1286718.patch | 1.25 KB | damiankloip |
#2 | vbo_test.tar_.gz | 1.44 KB | mradcliffe |
#2 | 0001-1286718-by-mradcliffe.-Switch-to-using-drupal_build_.patch | 1000 bytes | mradcliffe |
Comments
Comment #1
bojanz CreditAttribution: bojanz commentedSure, why not.
Comment #2
mradcliffeI was looking at either drupal_get_form, drupal_build_form, or drupal_rebuild_form. I ended up trying to work with drupal_build_form, but I lost the operation value on submit. I might need to analyze and change $form_state a bit more. Also tried working on a test file/module using admin_content default vbo view.
It probably isn't worth posting what I have, but I will in case anyone else wants to work on it.
Comment #3
bojanz CreditAttribution: bojanz commentedYeah, that is definitely a bad idea.
So, we either document that in order to modify a VBO form you need to do:
Or maybe add a hook_views_bulk_operations_form_alter().
Thoughts?
Comment #4
mradcliffeSorry for not replying, bojanz. This thread slipped my memory. I think that's suitable documentation for now, but maybe in 6 months we can look at doing hook_views_bulk_operations_form_alter().
Another quirk. If you do funky things like disabling checkboxes, it really confuses VBO and actions. Although I think that's more related to the js stuff. :-)
Edit: What's the plan for the book structure at http://drupal.org/node/335694? I'll start documenting there with a bit of guidance.
Comment #5
bojanz CreditAttribution: bojanz commentedI can't seem to edit that page for some reason.
Comment #6
tomas.teicher CreditAttribution: tomas.teicher commentedI cannot get it work. How can I edit vbo form in my hook_form_alter?
In particular, I want to edit form in that way, that I would have my custom submit function (with my custom submit button). But I cannot do it because selecting vbo operation in operations fieldset is required.
But I cannot edit the fieldset in form hooks.
Is it possible to achieve this without a patch?
Comment #7
bojanz CreditAttribution: bojanz commentedYou need the code in #3.
You also need to make sure your module runs after views_bulk_operations.
So if views_bulk_operations has a weight of "0", your module needs to have at least the weight of 1.
Weight is a column in the {system} table (though there's probably a contrib module that handles it as well).
Comment #8
tomas.teicher CreditAttribution: tomas.teicher commentedthanks it works OK
Tomas
Comment #9
damiankloip CreditAttribution: damiankloip commentedI think add a hook_views_bulk_operations_form_alter hook makes alot of sense. I have done something similar in textformatter now, it makes things alot easier for people altering, and saves a few support queries too :)
@bojanz - Do you want a patch for this?
Comment #10
bojanz CreditAttribution: bojanz commentedYes, please!
Comment #11
damiankloip CreditAttribution: damiankloip commentedHere is an initial patch for this, I'm not sure if this covers everything we need right off the bat but should be a good start.
Comment #12
damiankloip CreditAttribution: damiankloip commentedWith a newline at the end of the api.php file
Comment #13
bojanz CreditAttribution: bojanz commentedHow about this version?
Comment #14
bojanz CreditAttribution: bojanz commentedCommitted a tweaked version.