Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Views Bootstrap 5.5.4 — Minor update available for module views_bootstrap (5.5.4). Release: Rightup theme 1.0.3 — Minor update available for theme vartheme_bs5_rightup (1.0.3). Release: CommentOn 1.0.6 — Minor update available for module commenton (1.0.6). Release: ChatGPT Ads 1.0.3 — Minor update available for module chatgpt_ads (1.0.3). Release: Opensolr Search 5.1.3 — Minor update available for module opensolr_search (5.1.3). Release: ServiceM8 Webform Integration 1.2.1 — Minor update available for module servicem8_webform (1.2.1). Release: PostfixAdmin 1.0.0 — Initial release available for module postfix_admin (1.0.0)! Release: ip_analyser 1.0.3 — Minor update available for module ip_analyser (1.0.3). Module Revived: Swagger-PHP OpenAPI 3 documentation generator 1.0.0 — Module swagger_php updated after 10 months of inactivity (1.0.0). Security Coverage: Microsoft Azure AI — Module ai_provider_azure now has official Drupal security advisory coverage.

Event Scheduler Publish

Security covered

Part of the Event ecosystem · 16 projects

View on drupal.org

Although the ability to publish and unpublish exists in the Scheduler module, it works with any content entity.

This module allows you to schedule the publishing and unpublishing of any content entity type (node, term, or even path_alias (theoretically), plus any custom entity you might create - as long as it has a "status" property and the other fields listed below).

In addition it does this using the generic Event Scheduler module that uses Symfony events rather than hooks.

How to use

Assuming you have this module installed and enabled all you have to do is add either or both of the following fields to the entity or bundle:

* `field_scheduled_start`
* `field_scheduled_end`

These must be date fields storing in the `Y-m-d\TH:i:s` format. They can be just for the "date" part, in which case it will be assumed to be the start of the day for the publish, and the end of the day for the unpublish.

The timezone used will be the one belonging to the creator of the entity.

If the publish date/time is already past, the entity will be published immediately. Similarly for the unpublish date/time.

Events

You don't need to do any coding for this to work but for developers there are two events issued once the action has been performed:

  • EntityPublishedEvent when an entity has been successfully published.
  • EntityUnpublishedEvent when an entity has been successfully unpublished.

If you want to carry out other actions you will normally intercept those two in an event subscriber. Those two events are both delayed events and will be launched after the rest of the page has been built and sent to the browser.

If an entity is deleted while events are pending, those events are automatically removed.

And that's all there is to it.

Important note

No module of this type can guarantee publishing at an exact time because scheduled events depend on when "cron" is run. The more frequently it's run, the closer to the correct time the publish/unpublish will be.

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
4
Tracked since
Mar 2023
Latest release
3 years ago
Releases (12 mo)
0
Maintenance
Dormant

Release Timeline

Releases

Version Type Core Release date
2.2.0-rc4 Pre-release Apr 9, 2023
2.2.0-rc3 Pre-release Apr 8, 2023
2.2.0-rc2 Pre-release Mar 5, 2023
2.2.0-rc1 Pre-release Mar 5, 2023