Community Documentation

Views Bulk Operations (VBO) development guide

Last updated March 11, 2010. Created by infojunkie on May 11, 2009.
Log in to edit this page.

This guide applies to Drupal 6 only, starting with release 6.x-1.7

Developing operations for VBO

VBO reuses existing Drupal infrastructure to allow new operations to be added. The main method to create a new operation is by writing a Drupal Action. Please read the linked page first. VBO supports a superset of the capabilities of actions, so here are the steps to create an action that fully utilizes VBO.

Implement hook_action_info()

VBO supports a superset of the attributes that describe an action. Here are the added attributes:

  • parameters (optional): keyed array. This attribute gets appended as is to the $context array that is passed to action_function().
  • behavior (optional): array of flags. This attribute exists in the original Action specification, but is augmented here with additional flags:
    • views_node_property to signify that this action will show the node on-screen.
    • deletes_node_property to signify that this action might delete the node.

    These flags, along with the original changes_node_property, cause VBO to call node_access() on each node that is about to be acted upon, with the $op parameter corresponding to the specified flag(s). If VBO is invoked in direct execution mode or through Batch API, the current user's permissions are checked against the required node access. If a deferred execution mode such as Job Queue is used, then the uid of the user who fired the job is used.

  • permissions (optional): array of permissions. VBO calls user_access on each permission before accepting to execute the selected action.
  • aggregate (optional): boolean. If TRUE, all selected objects' IDs (oids) will be packed in an array and passed as the first argument to the action function, instead of passing each object one by one. This is useful to implement aggregate functions that perform a single operation on the whole selection set.

Implement action_function(&$object, $context)

TODO

Implement action_function_form($context)

TODO

Implement action_function_submit($form, $form_state)

TODO

Implement action_function_validate($form, $form_state)

TODO

Comments

VBO Extends Drupal Actions and Operations

This is just a rough bit of text that I'll add via comment instead of reworking the above document:

  • hook_views_bulk_operations_object_info()
    • If you're using actions or operations outside of nodes or users you need to define this so that VBO can pass the correct object into your action or operation. Drupal actions, by unfortunate oversight, do not support objects other than node or user.
  • hook_OBJECT_operations()
    • This is similar to node_operations or user_operations, where OBJECT is an object defined in hook_views_bulk_operations_object_info() above. This will allow you to operate on multiple objects at once instead of just one, which is a limitation of Drupal actions. There is no documentation on this hook and you cannot grep/search for it because the function is built dynamically.

Hi,

Just need some help from you regarding the following issue.

I have a created a view from a drupal database table using the data module with views and VBO.
The data module allows you to create a view from the adopted table.
But,
when I go to the views and edit the view added through the data module, i see no multi-checkbox list under selected operations.

I want to have all the operations that are available under the node view type to be available here, for my view created with data module. (views created with data module have a view type data table)

I tried creating a new .inc file with custom actions under views_bulk_operations folder but these actions show only under view type node and not under data table views selected operations. (referred your comments on taxonomy - http://drupal.org/node/470252)

Any help greatly appreciated.
Please help me ...
it's very very urgent.

Thanks,
Nilesh Barve

Hello boys:

I have a question about VBO.
I need to select multiple pages to add in a book, however I don´t know how to do it.

How I can do?

thnx for advantage!
Sussana

Lara

.

I'm not sure if there is a module that provides Book actions.

VBO 6.x-1.11-beta1

VBO 6.x-1.11-beta1 has 2 actions for books.

Is there no book actions in

Is there no book actions in version 7.x?

THX!

Lara

Not at the moment. Feel free

Not at the moment. Feel free to open a feature request.

Ok, I will do it. Thank you

Ok, I will do it.
Thank you very much for your answers!

Lara

Update admin content view from vbo 7.x

Hey guys:

I'm trying to update the vbo 7.x content view that I have modified. So if I´m not wrong I must go to path module and modify the existing path "admin/content" to "admin/content2".

However, when I´m going to admin content page, the changes have not been made.

Can anyone tell me if I did correctly?

thx!!

Lara

D7 actions documentation

Those looking for Drupal 7 specific documentation on creating actions for VBO, check out the Examples module, where you'll find action_example.module

Permissions

Note that permissions for custom actions are generated dynamically. If you have setup a default administrative role and expect to have access to the newly created permission automatically, you are mistaken.

Unless you manually assign the permission to the appropriate role, you will see your action in the Views config but your action will not show up on the View form.

Page status

About this page

Drupal version
Drupal 6.x
Audience
Developers and coders
Drupal’s online documentation is © 2000-2012 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License.
nobody click here