In working on #352328: Replace (optionally?) node/N/signups/admin with a views bulk operations view? I ran into a limitation with VBO and wrote a patch to fix it. I need to create a "Signup" view and have VBO operate on those records, not the users or nodes that they point to. However, you can only expose custom operations for users or nodes via the current views plugin handler. I know I could expose these operations as core actions, but what if I don't want to? ;)
So, this patch:
A) Adds views_bulk_operations_get_object_info() as a helper function that statically caches the results of module_invoke_all('object_info') so it can be re-used for free. This is probably a good performance improvement in and of itself.
B) Inside populate_operations() in the plugin handler, we invoke the above helper to find all the object types VBO knows about, and invoke a "$type_operations" hook for each object type, instead of hard-coding (and duplicating a lot of code for) node and user operations.
| Comment | File | Size | Author |
|---|---|---|---|
| vbo_per_type_operations_hooks.patch | 5.2 KB | dww |
Comments
Comment #1
infojunkieThanks for the great patch. I reviewed it and committed it to 6.x-1.x-dev. I just added a $reset = FALSE argument to the object_info caching function.