Views Bulk Operations (VBO)
Views Bulk Operations augments Drupal Views by allowing actions to be executed on selected view rows, providing checkboxes for row selection and a dropdown/buttons for available operations.
views_bulk_operations
Install
composer require 'drupal/views_bulk_operations:^4.4'
Overview
Views Bulk Operations (VBO) extends Drupal's Views module by adding the capability to perform bulk operations on entities displayed in view results. It provides a powerful interface for selecting multiple items and executing actions on them simultaneously.
The module shows checkboxes in front of each displayed row, along with a select box (or buttons) containing available operations. Users can select individual items, select all items on the current page, or select all items across all pages. Actions can be processed immediately or through batch operations for large datasets.
VBO integrates seamlessly with Drupal's core Action plugin system while providing enhanced functionality including preconfiguration of actions in Views admin, confirmation steps, configurable batch processing, and AJAX-powered multi-page selection tracking.
Features
- Adds a 'Views bulk operations' field to any entity view that displays checkboxes for item selection
- Provides action dropdown or action buttons for executing operations on selected entities
- Supports 'Select All' functionality across all pages, not just the current page
- AJAX-powered multi-page selection tracking with real-time count updates
- Batch processing support for handling large numbers of entities efficiently
- Configurable batch size for optimal performance
- Action preconfiguration in Views admin UI - set default values for action configuration
- Optional confirmation step before action execution with customizable help text
- Support for both core actions and custom VBO actions with enhanced capabilities
- Delete entities/translations action built-in
- Cancel user accounts action with multiple cancellation methods
- Drush commands for executing actions from command line
- Event-driven architecture allowing other modules to integrate custom entity views
- Label and message override capabilities for actions
- Clear selection on exposed filter changes option
- Flexible display options for selection box and select-all checkbox
Use Cases
Bulk content moderation
Create a view of unpublished content with a VBO field. Select multiple nodes and use the 'Publish content' action to publish them all at once. Configure a confirmation step to review selections before execution.
Mass user account management
Build a view of user accounts filtered by registration date or role. Use the 'Cancel user accounts' action to bulk-disable spam accounts or inactive users, with options to preserve or delete their content.
Automated content cleanup via Drush
Set up a cron job using 'drush vbo-execute' to automatically delete content older than a certain date. Use view arguments and exposed filters to target specific content types or conditions.
Multi-language content translation removal
Display a view of content translations and use VBO to selectively remove translations for specific languages while preserving the default language content.
Custom bulk operations for business logic
Create a custom action plugin extending ViewsBulkOperationsActionBase to implement site-specific business logic, such as sending notifications, updating custom fields, or integrating with external systems. Use preconfiguration for admin-defined defaults and runtime configuration for user input.
Restrict bulk operations by role
Enable the Actions Permissions submodule to create granular permissions. Assign 'execute [action] [entity_type]' permissions to specific roles, allowing content editors to publish but not delete, while administrators have full access.
Tips
- Use batch processing for any operation affecting more than 50-100 entities to prevent timeouts
- Enable the Actions Permissions submodule in production to control who can execute destructive operations
- Use action preconfiguration to set sensible defaults and reduce user errors
- The Drush commands are powerful for automated workflows - combine with cron for scheduled bulk operations
- When creating custom actions, extend ViewsBulkOperationsActionBase for full VBO feature support including context and view access
- Use the example module as a template when developing custom actions - it demonstrates preconfiguration, configuration, and execution patterns
- For non-standard views (like Search API), implement the ViewsBulkOperationsEvent subscriber to provide entity type and getter information
Technical Details
Admin Pages 3
/admin/structure/views/view/{view_id}
Configure the Views Bulk Operations field settings within a View's configuration. This is where administrators select which actions are available, configure batch processing options, and set UI preferences.
/views-bulk-operations/configure/{view_id}/{display_id}
Configuration form displayed when a configurable action is selected. Allows users to set action-specific options before execution.
/views-bulk-operations/confirm/{view_id}/{display_id}
Confirmation page displayed before executing an action when confirmation is required.
Hooks 1
hook_views_data_alter
Registers the VBO bulk form field as a global Views field available on all entity type views.
Drush Commands 2
drush views:bulk-operations:execute
Execute an action on all results of the specified view. Useful for automated bulk processing, cron jobs, or command-line administration.
drush views:bulk-operations:list
List all available VBO actions with their IDs, labels, and applicable entity types.
Troubleshooting 6
VBO is available under the 'Global' category in Views fields. Ensure the module is enabled and clear caches. The view must be based on an entity type (content, users, etc.) for VBO to work.
Ensure you have selected items using the checkboxes. If using multi-page selection, verify the AJAX updates are working (check browser console for JavaScript errors). Clear the selection and try again.
Reduce the batch size in VBO field settings. The default is 10, but complex actions may require smaller batches. Also check PHP max_execution_time and memory_limit settings.
Actions are filtered by entity type. If an action specifies a type (e.g., 'node'), it won't appear on user views. Also check if Actions Permissions submodule is enabled and user has required permissions.
This is expected behavior when 'Clear selection when exposed filters change' is enabled (default). Disable this option in VBO field settings to maintain selection across filter changes.
This occurs when the view's base table doesn't provide entity type information VBO can detect. Contrib modules need to implement the views_bulk_operations.view_data event to integrate with VBO.
Security Notes 5
- Always enable the Actions Permissions submodule in production environments to restrict access to destructive operations
- The Delete and Cancel User actions perform irreversible operations - consider adding confirmation steps
- VBO operations run with the current user's permissions - entity access checks are performed before each operation
- Drush commands execute as the specified user (default: user 1) - secure your Drush access appropriately
- Audit logs are created for entity deletions - review watchdog/dblog for tracking bulk operations