Scheduler Field: schedule actions on any Drupal entity

Contributed module by IOSAN — available at drupal.org/project/scheduler_field


The problem this module solves

Scheduling the publication or unpublication of content is a recurring need in every Drupal project. Existing solutions partially address this need, but almost all of them rely on custom entities, are limited to nodes, or cannot be extended without deep modifications.

Scheduler Field takes a different approach: storing scheduling information directly in the field table, as close to the entity as possible. The result is a lightweight, universal module designed to be extended.


How it works

The module introduces a new field type — the Schedule field — that can be attached to any fieldable Drupal entity. This field holds:

  • the scheduled action type (defined as a plugin),
  • a start date for the action execution,
  • an optional end date.

Scheduled actions are triggered by the Drupal cron. On each run, the system checks fields whose conditions are met and executes the corresponding actions.


A plugin-oriented architecture

The strength of Scheduler Field lies in its extensibility. Available actions are defined as plugins, allowing any development team to create new ones without modifying the module itself.

Two plugins are provided by default:

scheduler_field_type_disabled The default plugin. It performs no scheduled action. It is used when the scheduling feature should be disabled for a given field.

scheduler_field_type_publication This plugin handles publishing and unpublishing an entity by modifying its status property. This is the most common use case: publishing an article at a specific date, automatically unpublishing it after a given period.

Thanks to the plugin system, custom actions can be implemented, for example:

  • changing a moderation or workflow state (Content Moderation, Workflows),
  • updating a field value,
  • sending an email or triggering a notification,
  • calling an external service.

Advantages over alternatives

The existing alternative modules — scheduler, scheduled_publish, scheduled_updates, scheduled_transitions, advanced_scheduler — share several limitations:

  • They create custom entities to store scheduling information, which complicates imports, exports, migrations, and Views queries.
  • They are often limited to nodes.
  • They are rarely extensible without custom development.

Scheduler Field stores all data in the standard Drupal field table. This means scheduling information is directly accessible via Views, can be integrated into migration processes, and is exportable without additional tooling.


Compatibility

The module is compatible with Drupal 8, 9, 10, and 11.

The publication plugin provided by default (scheduler_field_type_publication) is not compatible with the content_moderation module. It does not handle revision transitions. For sites using a moderation workflow, it is recommended to create a dedicated plugin. A discussion thread on drupal.org (issue #3313975) documents this approach.

 

This module has been developed by the IOSAN tech team.

Feel free to reach out if you have any questions, or if you have a project and would like to learn more about the module's possibilities or our services.

This content is licensed under the terms of the Creative Commons Attribution-NoDerivatives 4.0 International License.
You are free to:

  • Share — copy and redistribute the material in any medium or format, provided that:
    • You give appropriate credit (mention the name IOSAN and provide a link to the original article),
    • You do not modify the content,
    • You do not use this content for commercial purposes without written permission.
Mon Drupal est en fin de vie

Mon Drupal est en fin de vie

Configuration minimum pour lancer phpunit avec Drupal

Configuration minimum pour lancer phpunit avec Drupal

Docker et OSX

Docker et OSX