We can see the canvas interface on this page, with 4 components with scheduling settings.

This project is not covered by Drupal’s security advisory policy.

Drupal Canvas is a visual page builder for Drupal. This module adds a Scheduled component to it. Put any block or component inside it, choose a publish date and an unpublish date, and visitors only see that content between those two dates. Nobody has to remember to come back at midnight to add or remove a banner.

Features

  • One wrapper that works for both blocks and single directory components (SDCs). The module never touches what is inside.
  • Both dates are optional. Set only a publish date to start showing content later, only an unpublish date to stop showing it, or both for a window.
  • Editors can still see and edit scheduled content in the Canvas preview. A badge above it says whether visitors see it now and when that changes. Click the badge to select the Scheduled component and edit its dates. The badge never appears on live pages.
  • The View scheduled content outside its schedule permission shows scheduled content on live pages to the roles that have it, whatever the dates.
  • Dates are read in the site's default timezone, not the timezone of the editor's browser.
  • When a date passes, cron clears the cache of the pages that use it, so visitors do not keep getting an old cached copy. This works for Canvas pages and other content with a Canvas field, and for content templates and page variants.
  • A French translation is included.

Typical uses: a seasonal banner, an event announcement that goes live on opening day, a closure notice that removes itself, a campaign block with a fixed run.

Post-Installation

There is no settings page.

  1. Enable the module.
  2. Open a page in Canvas and add the Scheduled component from the component library.
  3. Drag the blocks or components you want to schedule into its Content slot.
  4. Select the Scheduled component and set the Publish date and Unpublish date in the right-hand panel. Leave one empty for an open-ended schedule.

The timezone comes from your site's regional settings (Configuration, Regional and language, Regional settings).

Grant the View scheduled content outside its schedule permission to the roles that should see scheduled content on live pages outside its dates.

Additional Requirements

  • Drupal core 11.3 or later, with the core Datetime module.
  • Drupal Canvas 1.12 or later (developed against 1.12.0).
  • Cron that runs regularly. A date takes effect at the first cron run after it, so the precision is your cron interval.

None are needed.

Similar projects

  • Scheduler publishes and unpublishes whole content items. This module schedules individual parts inside a single Canvas page.
  • Block Scheduler and Schedule Block add dates to blocks placed in Drupal's Block Layout. They do not apply to Canvas components.

At the time of writing, we found no other module that schedules individual Canvas components.

Supporting this Module

Bug reports, patches and merge requests are welcome in the issue queue.

Community Documentation

Documentation and a demo will be added here as the project grows.

Good to know

  • This hides content when the page is rendered. It is not access control. The scheduled content is still stored in the page data, so do not use it to protect sensitive information.
  • A date that is set but cannot be read hides the content, and the badge in the preview says so.
  • Canvas date fields do not store the editor's timezone. The module reads the time as typed, in the site timezone, and ignores any timezone suffix on the stored value.
  • If a CDN sits in front of the site, it must be purged by cache tag for a date to reach visitors on time.

AI disclosure

AI was used to help develop this module and its documentation.

Supporting organizations: 

Project information

Releases