VBO Views Bulk Operations

Published Sep 22, 2022
Updated Nov 30, 2024
By Simon
Table of contents

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 View's 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. In November 2024, this number had dropped to 175,000 sites.
Requires No extra requirements.
Libraries No library.

Install either using the UI or composer.

Setting Up Views Bulk Operation

Basics

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.

Configuring Views Bulk Operation

If you clicked add and configure as illustrated in the previous step, then you will be on the setting modal. If you have installed a new module such as Views Bulk Edit, then click on the Global: Views bulk operations (Views bulk operations) field in the Views UI.

Image
vbo field in views

Things you can configure that are specific to VBO are using batch, setting a batch size, and various other settings. I suggest you check them out when you set up VBO on your own site. What ever you choose, make sure you test it.

Selected actions

One other important feature of View Bulk Operation is the ability to limit which operations can be used for the view. This is done in the selected action section. All the standard actions such as unpublish, publish, demote, promote, delete, etc. are available. If you want to update field content, then you will need to install and configure Views Bulk Edit to do that.

For each selected operation enabled, you can override the label and processing message, and also add a confirmation step.

Image
selected actions example VBO drupal

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 to provide that sort of control. Action permissions "adds access permissions on all actions, allowing admins to restrict access on a per-role basis". Enable Actions Permissions on the extend page of Drupal, it is part of the Views Bulk Operations module.

Summary

In this article, we look at why you may want to use Views Bulk Operations module, the main reason for me being the API that adds the ability to add custom views update actions. Then we looked at how to set VBO up and the configuration available.

VBO 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 VBO 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.

Notes

Remember selection(s) works better with VBO.

To do