How to integrate scheduler with custom / contrib entity types?

Created on 20 May 2025, 3 days ago

Problem/Motivation

Currently, we are working on a submodule of the Advertisement module that should implement a scheduler plugin so that the advertisement entities (ad_content bundled via ad_content_type) may have their publication scheduled. Here is our current module code.

Unfortunately, the documentation of this module is a bit unclear regarding certain steps that have to be taken for the plugin implementation. It also appears to mostly document creating support for a third-party module within Scheduler instead of using a scheduler plugin within another module.

Is there a best-practice, gapless approach for implementing a scheduler plugin as of the current state of the project? If so, could anyone please provide it or the link for it here? If it has not yet been documented properly, it definitely should be done, and we could take this issue to add it to the docs.

A pretty sound-looking explanation was made in this issue , but that on its own did not provide any apparent and usable functionality, as far as I have seen.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

💬 Support request
Status

Active

Version

2.0

Component

Plugin

Created by

🇩🇪Germany lrwebks Porta Westfalica

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @lrwebks
  • 🇩🇪Germany lrwebks Porta Westfalica
  • 🇩🇪Germany lrwebks Porta Westfalica
  • 🇬🇧United Kingdom jonathan1055

    Hi lrwebks,

    Did you see the Scheduler documentation site https://project.pages.drupalcode.org/scheduler/plugin_create/ ?
    I can't tell from your comments above, but you may have seen this, as it was the result of the first part of #3249560: Write documentation for the entity plugin which you have linked to.

    I'd be happy to help with questions and to update the documentation if there are specific things that are missing. If you could use those steps and note down any places where you get stuck, or it is not clear, then we can improve those pages.

    Other issues on creating a plugin which may (or may not!) be helpful:
    Support for Block (display) entities Active
    Paragraph scheduler plugin Needs work
    Scheduler plugin for Commerce Product Variation Active

  • 🇩🇪Germany lrwebks Porta Westfalica

    Thanks for your quick response, @jonathan1055,

    indeed I was aware about the docs page that you linked, but within the list of steps there appear to be a few instructions, that seem to me like this is meant to be implemented within the Scheduler Module (like support for a module from your module's side, the way that you have done it with Commerce Product already).

    Examples of what I mean:

    Add extra two lines in config/schema/scheduler.schema.yml to use the saved alias for the new third party settings.

    In scheduler.install add a hook_update function to load the new view.

    This was the case for Media and Commerce Products (note from lrwebks: Two of the modules that scheduler supports internally, which is not what we want to achieve with our module)

    Update README.md to include the new entity in the list of implementations.

    Is it enough to avoid the steps which require modification of the scheduler module, for our custom plugin implementation? Or do we have to handle that differently? If so, what are the required steps?

  • 🇬🇧United Kingdom jonathan1055

    Thanks for pointing out those bits. Yes the doc page could do with some re-work, as you are correct - those lines are specific to internal plugins provided by scheduler. I wrote it up from my notes when making the first plugin, media, and then refined it as we added commerce_product and taxonomy_term.

    Is it enough to avoid the steps which require modification of the scheduler module, for our custom plugin implementation?

    In general, yes. But there may be some things that you need to do in your module instead. An example is the first on your list - you will want to have all scheduler settings available in your content type. Whether you simply copy those from the schuduler schema or somehow get them defined dynamically to avoid duplication, you can decide on how you want to tackle it.

    I think we can use this issue to make some changes to the documentation, to explain when some steps are not required and when the change needs to be done in the 3rd-party module.

Production build 0.71.5 2024