Make compatible with Scheduler

Created on 24 October 2020, over 4 years ago
Updated 14 February 2024, about 1 year ago

Problem/Motivation

At first I was thinking it would be good to have an auto publishing scheduler for events which offsets the publishing time of each event instance relevant to their individual Start Dates but I then quickly realised that my use case, and probably most other use cases, needs all instances in a series published at the same time, however, there is a need to schedule the publishing of entire series. So making RE compatible with the Scheduler module would be a very useful feature add. Especially in situations where series' with consecutive and daily recurrences have lots of instances cluttering the space in a site.

Feature request
Status

Active

Version

2.0

Component

Recurring Events (Main module)

Created by

🇦🇺Australia the_glitch

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • First commit to issue fork.
  • Merge request !86Implement Scheduler plugin for event series → (Open) created by kasperg
  • Status changed to Needs review about 1 year ago
  • 🇩🇰Denmark kasperg

    I took a stab at implementing support for Scheduler for event series.

    I implemented support directly within the main Recurring Events module like it is the case for the integration with Migrate, Views and Fullcalendar. Another approach would be to add a new submodule like group_recurring_events_series which integrates with the Group module. I ended up with this approach as the amount and complexity of the integration is quite limited.

  • 🇩🇰Denmark kasperg

    It is worth noting that the Scheduler configuration option "Change creation time to match the scheduled publish time" (publish_touch) will not work with event series. It will throw a hard error during cron when an event is to be published.

    The option requires a setCreatedTime() method being available on the scheduled entity. Event series do not provide one at the moment. As I see it there is currently no way to prevent this option from being offered on certain entity types.

  • 🇨🇦Canada endless_wander

    @kasperg this would be a very welcome feature for my client and I would love to help as I can. I will take some time to test your modifications. Let me know if I can do anything else

  • 🇨🇦Canada endless_wander

    @kasperg this isn't working for me. I can set the Scheduler options for my Event Series type and make the fields appear when creating or editing an Event Series. If saving the Event Series with a "Publish on" or "Unpublish on" value, I do not see that value reflected in the EventSeries entity values. There are no "publish_on" or "unpublish_on" values. As a result, re-loading the Event Series editing form shows the "Publish on" and "Unpublish on" fields are blank again. No scheduling occurs. I am using the "default" Event Series type.

    To reproduce, install Devel module and check the entity values on the Devel tab after saving an Event Series with scheduler values. You will see that no publish_on or unpublish_on values are stored.

  • Status changed to Needs work about 1 year ago
  • 🇩🇰Denmark kasperg

    @endless_wanderer: Thanks for taking the time to take a look at this.

    Currently I have the luxury of being able to reinstall our project frequently and the new fields are added here as expected. Given your findings I assume that something needs to be done to add this support to running systems. I expect this to involve an update hook of some kind.

    If someone can point me in the right direction I am willing to take another look at this.

  • First commit to issue fork.
  • 🇧🇷Brazil carolpettirossi Campinas - SP

    I'm trying to make the Scheduler work with Event Series and Event Instances.
    Unfortunately, the patch didn't work perfectly.

    With the original code from the MR, I had to force execution of the following code:

       $scheduler_manager = \Drupal::service('scheduler.manager');
        if ($result = $scheduler_manager->entityUpdate()) {
          return t('Added Scheduler date fields to the following entity types: %updated.', [
            '%updated' => implode(', ', $result),
          ]);
        } else {
          return t('No database fields had to be added.');
        }
    

    Even after that, when I published the Event Series using workflows, meaning that I moved to "Published" state in the workflow, the Event Series was not published as expected since the Publish On was in the future. However, all event instances were published.
    In my use case (and I image that this is the most common use case):
    - The event instances must inherit the Publish On and Unpublish On configuration by default and be published only when the Event Series is published.

    To achieve the above:
    - I extended the Scheduler to also be available on the EventInstance entity type. (added to the MR)
    - I added a hook_update to execute the code I sent above (added to the MR)
    - I created field inheritance with "Inherit" configuration for the "Publish On" and "Unpublish On" fields. (not yet added to the MR, if you need this, you need to do manually)

    Note:
    For some reason, I couldn't use the fallback approach in the field inheritance. It would be preferable for me, but I don't know where I should look and investigate why the fallback doesn't list the Publish On/Unpublish On fields in the Destination field.

  • Status changed to Needs review 2 days ago
  • 🇪🇸Spain plopesc Valladolid

    We needed this integration for our project and this looks very good.

    However, I would go for a submodule based approach to ensure the encapsulation and avoid possible conflicts between the different scheduler versions.

    Moving to NR to get some new feedback from module's maintainers.

  • Merge request !145Issue #3178696: Make compatible with Scheduler → (Open) created by plopesc
  • 🇪🇸Spain plopesc Valladolid

    Opened a new MR for the submodule approach to make easier the comparison for module maintainers.

  • Pipeline finished with Success
    2 days ago
    Total: 174s
    #479057
  • Pipeline finished with Failed
    2 days ago
    Total: 193s
    #479081
  • Pipeline finished with Success
    2 days ago
    Total: 166s
    #479085
Production build 0.71.5 2024