Bulk Editing Field Data in Drupal with Views Bulk Edit

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

Views Bulk Edit module has to be one of my favourite modules. There is something pleasing about being able to select a bunch of content you want to modify in the same way and do it in bulk. Before you can set up the module, however, you will need to install Views Bulk Operations or VBO module, as Views Bulk Edit hooks into the views bulk operations custom actions API.

If you haven't installed VBO, please check out the first part, which explains how to install VBO and how to set up a view to use it. Once that is done, please read on.

Views Bulk Edit

Now we have the new VBO field set up for our view, let's look at the Views Bulk Edit module.

I have used the Views Bulk Edit module in various situations, from bulk updating field data from Drupal upgrades or adding new fields and then needing to add a value to all the old content in bulk. 

I have also used it in a custom gallery and album management system where after bulk uploading media image entities to an album you could tag the media entities to make them more searchable.

Info

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

Actively maintained Yes, 15,500 sites report using it at the time of writing. 25,000 sites report using it, November 2024,
Requires Views Bulk Operations (VBO) https://www.drupal.org/project/views_bulk_operations
Libraries No library.

Install either using the UI or composer.

Setting Up Views Bulk Edit Module

Basics

Once installed, you will now find the new action, modify field values, in the selected actions section of the VBO settings. All you need to do is check it and it becomes available.

Check out the section on configuring views bulk operations and in particular selected actions.

Image
configure views bulk operations to use views bulk edit

You may want to limit what fields you can edit when using the views bulk edit functionality. For example, it doesn't really make sense to allow the bulk update of the title & body fields in most cases1. To limit the fields in the form, you can add a form display mode, so let's have a look at how we can do that.

Image
views bulk edit modify field values default form
Views bulk edit modify field values default form has all the field and setting field which in most cases aren't needed. Let's fix that.

Limit the fields in the bulk edit form

To limit the fields that can be bulk edited, you can add a bulk_edit form mode and configure it for each content type.
/admin/structure/display-modes/form

Manage >  Structure > Display modes > Form modes
/admin/structure/display-modes/form

  1. Click on + Add form mode.
  2. Choose content.
  3. Add Bulk Edit and make sure the machine name is node.bulk_edit 

    Image
    adding bulk edit form mode
  4. Click Save
     

Now visit the Content Type you want to add the form mode to and click on the Manage from display tab

Manage >  Structure > Structure > Content types  > Article 
/admin/structure/types/manage/CONTENT_TYPE/form-display

At the bottom of the Manage from display tab, you will see Custom display settings,

  • Open the element
  • Check Bulk Edit.
  • Click Save
Image
modify field values with new bulk edit form mode 144

Now you should have a secondary Bulk edit tab, click on this and then:

  • Drag any field you don't want to use in the bulk edit functionality to the disabled section.
  • Click Save
Image
manage form display showing the custom bulk_edit form mode
Manage form display showing the custom bulk_edit form mode tab with disabled title field ready to be saved.

Using Views Bulk Edit

When you select a bunch of content to be bulk updated in the view, you are only present with the fields that are allowed to be bulk updated. This is a much better user experience and also prevents someone from mistakenly updating a field for multiple pieces of content that shouldn't be.

I only wanted to enable bulk update and management tags. The following image shows what the UI will look like in this case.

Image
modify field values form with custom form mode applied

Bulk Update Tags

A nice feature that is part of bulk edit tags is that you can override the current tags, or you can add to the tags.

Image
bulk edit tags in drupal
Bulk editing tags in Drupal can replace or add to a multi-value field.

To bulk update the field you fill in the form and click apply, it is that easy.

Summary

In this article, we looked how you can install and set up Views Bulk Edit module in Drupal. We also looked setting up a custom form mode so you can restrict what is present in the edit form. In the example, we restricted the bulk edit form to tags only, but you could add any fields you like.

That's it for view bulk edits, can you think of other uses or have you used it for other situations? I'd love to hear your different use cases for this awesome module combo.

If front-end development and design are your things, be sure to sign up for the newsletter by using the sign-up form below. I cover modern front-end development and also how you can use Drupal as a complete CMS or use it as a headless CMS with a decoupled front-end. Thanks for reading and all the best with your day

1 Bulk update the title field or URL field if using a token may make sense, however bulk URL updates can be done with URL aliases.

Notes

custom gallery and album management system where after bulk uploading media image entities to an album you could tag the media entities to make them more searchable.

To do

1 Bulk update title field or URL field if using a token. - make this clearer

To do