Moderated Content Bulk Publish
Provides bulk operations for publishing, unpublishing, archiving, pinning, and unpinning moderated content from the admin/content page.
moderated_content_bulk_publish
Install
composer require 'drupal/moderated_content_bulk_publish:^2.0'
Overview
The Moderated Content Bulk Publish module extends Drupal's content moderation system by providing essential bulk operation plugins that are not available in core. It enables site administrators to perform batch operations on moderated content directly from the /admin/content view.
The module is designed to work seamlessly with content types using the editorial workflow provided by Drupal core's Workflow and Content Moderation modules. It properly handles multilingual sites by processing all translations of content items during bulk operations.
Key capabilities include publishing the latest revision (even if it's a draft), unpublishing content by moving it through archived to draft states, archiving content, and managing the sticky (pin/unpin) status of nodes. The module also provides an optional confirmation dialog to prevent accidental bulk operations, a toolbar language switcher for multilingual sites, and a 403 error handler that gracefully redirects when latest revisions don't exist for translations.
For developers, the module provides hook APIs that allow external modules to implement custom verification logic before publish or archive operations are executed, enabling integration with content validation systems like Safe Delete.
Features
- Publish latest revision of moderated content in bulk, even when the latest revision is a draft
- Unpublish current revision by transitioning through archived to draft state with proper handling of all translations
- Archive current revision of content in bulk operations
- Pin (sticky) and Unpin content in bulk from the admin content listing
- Optional confirmation dialog for bulk operations on the admin/content page to prevent accidental changes
- Optional confirmation dialog when publishing content from the node edit form
- Toolbar language switcher for sites with multiple languages enabled
- Graceful 403 redirect handling when latest revision doesn't exist for a translation
- Hook API for custom verification before publish and archive operations
- Automatic Pathauto alias updates during bulk operations
- Configurable option to retain original revision author information during bulk publish
- Support for both node and media entity types in publish/unpublish operations
Use Cases
Publishing multiple draft articles at once
When content editors have reviewed and approved multiple articles that are currently in draft state, they can use the 'Publish latest revision' bulk action from /admin/content to publish all of them at once. Simply select the articles using the checkboxes, choose 'Publish latest revision' from the action dropdown, and apply. A confirmation dialog will appear if enabled.
Unpublishing outdated content in bulk
When seasonal content or time-sensitive articles need to be taken offline, editors can select multiple items and use the 'Unpublish current revision' action. This transitions content through the archived state to draft, ensuring proper workflow state management.
Managing sticky content for featured sections
For homepage or section featured content that needs to be rotated regularly, editors can use the 'Pin Content' and 'Unpin Content' actions to quickly manage which articles appear at the top of listings without editing each node individually.
Archiving legacy content
When content reaches end-of-life but shouldn't be deleted, the 'Archive current revision' action allows bulk archiving of multiple items. This is particularly useful for legal compliance where content must be preserved but not publicly accessible.
Multilingual content workflow
On multilingual sites, when the source language content is approved for publication, the module automatically processes all translations, ensuring consistent moderation states across all language versions of the content.
Implementing custom publish validation
Developers can implement hook_moderated_content_bulk_publish_verify_publish to add custom validation before content is published, such as checking for broken links, required fields, or compliance requirements. If validation fails, the publish is blocked and an error message is displayed.
Tips
- The confirmation dialog can be disabled for automated testing by running: jQuery('*').unbind('click.moderated_content_bulk_publish')
- When 'Retain revision authoring information' is enabled, the original author and date are preserved while appending the bulk publish user and date to the log message
- For multilingual sites, the current language is always processed first to avoid database transaction issues, with other languages processed during PHP shutdown
- The module logs all bulk operations to the Drupal log under the 'moderated_content_bulk_publish' channel for auditing purposes
- Media entities are supported for publish and unpublish operations, not just nodes
Technical Details
Admin Pages 1
/admin/config/content/moderated-content-bulk-publish
Configure settings for the Moderated Content Bulk Publish module including confirmation dialogs and toolbar language switcher options.
Permissions 5
Hooks 2
hook_moderated_content_bulk_publish_verify_publish
Allows modules to verify and validate content before bulk publishing. Can be used to prevent publishing if certain conditions are not met.
hook_moderated_content_bulk_publish_verify_archived
Allows modules to verify and validate content before bulk archiving. Can be used to prevent archiving if certain conditions are not met.
Troubleshooting 6
Ensure you have added the 'Node operations bulk' field to your content view at /admin/structure/views/view/content and selected the desired operations from the field configuration.
Check that users have the appropriate permissions: 'moderated content bulk publish', 'moderated content bulk unpublish', 'moderated content bulk pin content', 'moderated content bulk unpin content', or 'moderated content bulk archive'.
Verify your content type is configured to use the editorial workflow with Content Moderation. Check that your workflow has the required states (published, draft, archived) and that transitions are configured correctly.
The module includes a handler for this. If still occurring, ensure the HandlerFor403AccessDenied event subscriber is properly registered. Clear caches after installation.
Verify that dialogs are enabled in the module settings at /admin/config/content/moderated-content-bulk-publish. Also ensure JavaScript is loading correctly by checking for console errors.
Ensure Pathauto module is installed and properly configured. The module calls Pathauto's generator service during the shutdown function to update aliases for all translations.
Security Notes 3
- All bulk operations require specific permissions and verify user access before executing
- The module respects Content Moderation's access controls when checking if users can edit moderation states
- Input from hook implementations is sanitized using mb_convert_encoding before being displayed in messages