VBO Views Bulk Operations

Published Sep 22, 2022
Updated Sep 27, 2022
By Simon

Views is excellent, having the ability to build database queries and create collections of data within the UI is one of the powerful features of Drupal. And this is possible with almost little or no knowledge of SQL. Views also has many pluggable enhancements, that in time, you may find you need and this article is going to look at one of them. In this article, we will look at VBO or Views Bulk Operations and in a second part we will look at Views Bulk Edit that has VBO as a dependency.

We will first look at VBO, why you may want to use it as a stand-alone module, how to install it, and some basic settings.

Why use VBO; View Bulk Operation?

If you visit the project you will see the list of features that VBO come with, which includes possibly the most important feature, the ability to process large amounts of data using a batch.

Here is the list of features:

  • Batch functionality.
  • Actions configuration via UI or YAML.
  • Simple API to add custom actions.
  • Ability to add a confirmation step.
  • Persistence across all view pages.

The simple API so other modules can hook into VBO and add actions that don't come with Drupal is the main reason I use this module. An action I have found useful is the ability to update field data in bulk and this is where Views Bulk Edit comes in. We will look at Views Bulk Edit after we look at setting up VBO.

Info

https://www.drupal.org/project/views_bulk_operations

Actively maintained Yes, 200,000 sites report using it at the time of writing.
Requires No extra requirements.
Libraries No library.

Install either using the UI or composer.

Basics

Setting Up Views Bulk Operation

When setting up the view you need to remove the default Content: Node operations bulk form that ships with Drupal, this is on the default content views that allow you to bulk publish/unpublish, promote, and stick content to the top of your views amongst other things.

Image
views UI for remove field sktch; views main UI and rearrange modal
Views UI for removing a field: views main UI fields section on the left and rearrange modal on the right with the remove field link.

Then you need to add the Global: Views bulk operations field by using the Add button on in the fields section on the Views interface. Once you have the field selected click Add and configure field.

Image
views bulk operation global field selection using the add field modal from Drupal views

Next, configure the Bulk operations field as you see fit.

Things you can configure are using batch, limiting which operations can be used for the view and then for each operation enabled you can add a confirmation step and override the label.

Permissions

As such there are no permissions for the module, if you have permission to use the admin view you have permission to use the views bulk operations. However, you can enable Actions Permissions for more fine-grain control over actions if you need that sort of control. Action permissions "adds access permissions on all actions allowing admins to restrict access on a per-role basis".

That's it for VBO module, all in all, it is probably not needed on a basic site with a small amount of content but it's definitely good to know it's available, stable, and maintained.

However, if you want to be able to modify field values in bulk you will need it so you can install View Bulk Edit. In part 2, we will look at View Bulk Edit.

Thanks for dropping by the Kojo, if you are interested in front-end development and design be sure to drop your email in the form below to get a weekly dose of thoughts and tips. Until next time, seize the day.