Scheduled Transitions

Allows users to schedule content revisions to change their moderation state at a specific date and time.

scheduled_transitions
2,921 sites
47
drupal.org

Install

Drupal 11 v2.8.3
composer require 'drupal/scheduled_transitions:^2.8'
Drupal 10 v2.7.0
composer require 'drupal/scheduled_transitions:^2.7'

Overview

Scheduled Transitions is a powerful workflow automation module that integrates with Drupal's Content Moderation system. It enables content editors and administrators to schedule state changes for entity revisions at predetermined times, automating the publishing workflow process.

The module creates a custom entity type to store scheduled transitions and provides a comprehensive UI for managing them. Each scheduled transition records the target entity, revision, new moderation state, execution date, and the user who scheduled it. Transitions can target either a specific revision or automatically use the latest revision at execution time.

Processing occurs through Drupal's queue system in a two-step process: first, ready transitions are added to the queue, then queue workers execute the actual state changes. This can be automated via cron or managed manually using Drush commands.

The module supports multi-lingual sites by tracking the language of the revision being transitioned, and handles complex scenarios like recreating pending drafts after publishing an older revision.

Features

  • Schedule any entity revision to transition to a different moderation state at a specific date and time
  • Support for scheduling the latest revision dynamically - the actual latest revision at execution time will be used
  • Option to recreate pending drafts after publishing historical revisions to preserve unpublished work
  • Per-entity type and bundle configuration for enabling scheduled transitions
  • Dynamic permission system generating view, add, and reschedule permissions per entity type/bundle
  • Customizable revision log message templates with token support for transition details
  • User-overridable revision log messages per scheduled transition when enabled
  • Entity tab integration showing all scheduled transitions for any enabled entity
  • Admin interface listing all scheduled transitions across the site with Views integration
  • Reschedule functionality to change execution time of pending transitions via modal dialog
  • Two-step queue processing: job creation and execution can be separated for fine-grained control
  • Configurable retention of processed transitions with optional links to created revisions
  • Automatic cleanup of scheduled transitions when host entities or revisions are deleted
  • Mirror operations feature to defer access checks to standard entity operations like update
  • Token system providing transition state information for revision logs and other integrations
  • Event system allowing custom logic to determine which revision should be transitioned
  • Drush command for manually triggering queue job creation
  • Full Views integration with custom field handlers for state labels and revision links

Use Cases

Scheduled Publishing

Schedule content to be published at a specific date and time. Create a node in Draft state, then add a scheduled transition to move it to Published at the desired time. The module will automatically create the published revision when the scheduled time arrives.

Time-Limited Content

Publish content that should be automatically unpublished later. After publishing content, add a scheduled transition to move it to an Archived or Unpublished state at a future date. Useful for event announcements, promotions, or seasonal content.

Embargo/Lift Workflows

Manage content under embargo that should be released at a specific time. Store embargoed content in a custom 'Embargoed' state, then schedule a transition to Published when the embargo lifts. Multiple transitions can be chained.

Content Review Cycles

Automatically move content through review states. Schedule a transition from Published to 'Needs Review' state at regular intervals to ensure content is periodically reviewed and updated.

Rollback Scheduling

Use the historical revision feature to schedule reverting to a previous revision. Select a specific revision to transition instead of the latest, useful for scheduled rollbacks of problematic changes.

Multi-Language Publishing

Schedule language-specific transitions independently. Each translation can have its own scheduled transitions, allowing different languages to be published at different times based on regional requirements.

Draft Preservation During Publishing

When publishing an older revision while a newer draft exists, enable 'Recreate pending revision' to automatically restore the draft on top of the new published version, preserving work in progress.

Tips

  • Run 'drush scheduled-transitions:queue-jobs' and 'drush queue:run scheduled_transition_job' every 1-5 minutes for precise scheduling accuracy
  • Use the 'Latest revision' option when you want the transition to apply to whatever the current state is at execution time, rather than a specific revision
  • Enable 'Recreate pending revision' to preserve draft work when publishing older revisions
  • Mirror operations to 'update' for simpler permission management - users with edit access automatically get scheduled transitions access
  • Use the optional Views-based listing at /admin/content/scheduled-transitions for more customizable admin views
  • Processed transitions can be retained for auditing purposes - configure retention duration in settings
  • Token support in revision logs helps create clear audit trails - customize templates to match your workflow
  • The event system allows custom revision selection logic for advanced use cases like A/B testing or conditional publishing

Technical Details

Admin Pages 5
Scheduled transitions settings /admin/config/workflow/scheduled-transitions

Configure which entity types and bundles can use scheduled transitions, set up automation options, customize revision log message templates, and configure processing behavior.

Scheduled transitions /admin/content/scheduled-transitions

Administrative listing of all scheduled transitions across the site. Shows the target entity, scheduled date, and provides operations for rescheduling or deleting transitions. Requires 'view all scheduled transitions' permission.

Scheduled transitions {entity_canonical}/scheduled-transitions

Entity-specific tab showing all scheduled transitions for the current entity. Displays revision information, state changes, scheduled dates, and processing status. Available on any entity with scheduled transitions enabled.

Add scheduled transition {entity_canonical}/scheduled-transitions/add

Form to create a new scheduled transition for an entity. Allows selecting a source revision (or latest), choosing a transition/target state, and setting the execution date. Opens as a modal dialog.

Reschedule scheduled transition /admin/scheduled-transition/{scheduled_transition}/reschedule

Modal form to change the execution date/time of an existing scheduled transition.

Permissions 5
Administer scheduled transitions

Access the scheduled transitions settings form to configure enabled entity types, automation, and message templates. Restricted access permission.

View all scheduled transitions

View the administrative listing of all scheduled transitions at /admin/content/scheduled-transitions.

View scheduled transitions for {entity_type}:{bundle} entities

Dynamic permission generated per enabled entity type/bundle. Allows viewing the scheduled transitions tab on entities of this type.

Add scheduled transitions for {entity_type}:{bundle} entities

Dynamic permission generated per enabled entity type/bundle. Allows creating new scheduled transitions for entities of this type.

Reschedule scheduled transitions for {entity_type}:{bundle} entities

Dynamic permission generated per enabled entity type/bundle. Allows changing the execution time of existing scheduled transitions.

Hooks 1
hook_scheduled_transitions_new_revision

Not a traditional hook - uses Symfony event subscriber pattern instead. Subscribe to ScheduledTransitionsEvents::NEW_REVISION to customize revision selection.

Drush Commands 2
drush scheduled-transitions:queue-jobs

Creates queue items for all scheduled transitions that are ready to be processed (transition_on date has passed). Transitions are locked to prevent duplicate processing.

drush queue:run scheduled_transition_job

Process the scheduled transition queue. This is a core Drush command that runs items created by queue-jobs.

Troubleshooting 6
Scheduled transitions are not being processed

Ensure cron is running frequently. Check if 'Create scheduling jobs in cron' is enabled in settings, or run 'drush scheduled-transitions:queue-jobs' manually followed by 'drush queue:run scheduled_transition_job'. Verify the transition_on time has passed.

Users cannot see the Scheduled transitions tab

Verify the entity type/bundle is enabled in settings. Check that users have the appropriate 'view scheduled transitions {type} {bundle}' permission. If using mirror operations, ensure users have the mirrored operation permission (typically 'update').

Transitions execute but target wrong state

Ensure the workflow transition selected is valid for the source revision's current state. Check if the workflow or states have been modified since the transition was created.

Permission warnings shown in settings

Grant at least one role the 'view scheduled transitions' and 'add scheduled transitions' permissions for enabled entity type/bundles at /admin/people/permissions.

Transitions stuck in queue or locked

Transitions are locked for 30 minutes when added to queue. If processing failed, wait for lock to expire or manually update the locked_on field in the database. Check logs for processing errors.

Revision log shows wrong state names

State names in revision logs are determined at execution time. If workflow states were renamed after scheduling, the new names will be used. If states were deleted, a fallback message appears.

Security Notes 4
  • The 'administer scheduled transitions' permission has restricted access and should only be granted to trusted administrators
  • Transition execution respects workflow transition permissions - users can only schedule transitions they're allowed to perform
  • Mirror operations defer to entity access checks, maintaining existing access control patterns
  • Scheduled transitions are automatically deleted when their host entity or revision is deleted, preventing orphaned data