Scheduling Content Changes in Drupal 8

Senior Drupal Developer

Scheduling Content Changes in Drupal 8

Scheduling Content Changes in Drupal 8

Looking to schedule content for your Drupal 8 site? With Drupal 7, there are a few options available such as the Scheduler module or a custom-built solution. One of the main issues with Scheduler module is that it’s not very flexible, meaning the only scheduled operations that could be performed are to either publish or unpublish a node.

In Drupal 8, Scheduler module is still around, although still limited to only publish or unpublish operations. Of course, there is always the option to custom build a solution, but I’ve recently come across an even better alternative that provides a flexible way to schedule content changes. The Acquia-funded contributed module is called Scheduled Updates. In a nutshell, it allows you to perform scheduled operations on essentially any entity field values at a specific date/time. Another nice feature is that it allows you to configure multiple updates, such as publish a node at a specific date/time and then unpublish it at a later date/time.

To install and configure the module, follow the following steps:

Step 1: Download, install and enable

Download, install, and enable the Scheduled Updates module.

In a Drupal 8 composer workflow, the module should be added to your site’s composer.json and installed during the `composer install`.

The module can be enabled via Drush, such as `drush en scheduled_updates -y` or via the module list page.

Step 2: Configure Scheduled Updates module

Visit the configuration page under Configuration → Workflow.

For this example, we will be configuring a scheduled job to automatically set an Article node to `promoted` at a specific date/time. This will demonstrate a popular use case that is possible by this module.

Step 3: Manage Fields

If we go to the Article `Manage Fields` page, we can see a new field was created.


Step 4: Manage Form Display

If we go over to the Article `Manage Form Display` page, there are a few options, but for this tutorial, we can leave them unchanged.

Step 5: Create scheduled content

Now, we can create a new Article node and see the Scheduled Updates in action.

Now that the scheduled update has been created, save the node.
It will be set to the `promoted` status once the scheduled update job runs during the next cron run.

Step 6: Perform scheduled content updates during cron run

The next time cron runs, we will get this message:

We can also see that the node is now set to the Promoted status on the node edit page.

Known issues:

Drupal is not guaranteed to run cron. Assuming Drupal has cron set to run every 3 hours, at the specified interval, such as 3 hours, cron will run cron every 3 hours if pages are being hit on your site, meaning if your site is getting enough traffic to get the pages hit that often.

To work around this limitation, and to make sure Scheduled Updates (or Scheduler for that matter) works properly, cron can be set on the server, assuming the server allows that sort of access. Depending on the timing and frequency of your updates, that will decide what cron setting you should configure on the server.

For example, if you create scheduled content on 30-minute increments (one at 12:30 PM, two at 3:00 PM, three at 4:30 PM), you’ll most likely want to have the server automatically run cron every 30 minutes to be sure that cron is run at the right time to kick off the scheduled update.


You can find further information at these resources:

In closing, I hope this blog post demonstrated the benefits of the Scheduled Updates module, such as it’s flexibility with entity field operations, robustness in adding multiple scheduled updates on a single node, and the ease of configuration and user experience.

Additional Resources
How To Think About Drupal 8 | Blog
Drupal 8 - The Entity CMS | Blog
Deep Dive Into Translating Paragraphs | Blog

comments powered by Disqus