Provide an EventInstanceCreator plugin that does nothing

Created on 8 October 2024, 4 months ago

Problem/Motivation

In one of our projects the customer wants to ensure that no event instances are created or deleted if an event series is published. They want to preserve existing registrations for published events at all costs.

Proposed resolution

Provide a NoOperationEventInstanceCreator that does not create or delete any event instances.
In a custom module we can implement hook_recurring_events_event_instance_creator_plugin_alter() to switch to the "safe" plugin.

API changes

A new plugin type is added. This does not break B/C in any way.

✨ Feature request
Status

Active

Version

2.0

Component

Recurring Events (Main module)

Created by

πŸ‡§πŸ‡¬Bulgaria pfrenssen Sofia

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

Merge Requests

Comments & Activities

  • Issue created by @pfrenssen
  • πŸ‡§πŸ‡¬Bulgaria pfrenssen Sofia
  • πŸ‡§πŸ‡¬Bulgaria pfrenssen Sofia
  • πŸ‡§πŸ‡¬Bulgaria pfrenssen Sofia
  • πŸ‡§πŸ‡¬Bulgaria pfrenssen Sofia
  • πŸ‡ΊπŸ‡ΈUnited States dustinleblanc Ithaca, NY

    I've tried implementing this but nothing seems to be changing. I took at look at EventInstanceCreatorPluginManager and it looks like it calls this:

       $this->alterInfo('eventinstance_creator_info');
    

    Which I think would make the hook hook_eventinstance_creator_info_alter() based on the docs in the default plugin manager docblock:

      /**
       * Sets the alter hook name.
       *
       * @param string $alter_hook
       *   Name of the alter hook; for example, to invoke
       *   hook_mymodule_data_alter() pass in "mymodule_data".
       */
      protected function alterInfo($alter_hook) {
    

    I trieded messing with the hook naming but nothing seems to be changing at all. Do we have any test cases of this working in the wild?

  • πŸ‡ΊπŸ‡ΈUnited States owenbush Denver, CO

    The `eventinstance_creator_info` hook is an alter hook for the plugin manager, so you can alter the plugin information, if you want to change the actual plugin used when creating instances, you either need to implement `hook_recurring_events_event_instance_creator_plugin_alter` or you can go to `/admin/structure/events/series/settings` and set the plugin to use in the `Event Instance Creator Plugin` field.

  • πŸ‡§πŸ‡¬Bulgaria pfrenssen Sofia

    @dustinleblanc, there is an example hook implementation in the issue summary.

  • πŸ‡ΊπŸ‡ΈUnited States dustinleblanc Ithaca, NY

    Yeah @pfrenssen I tried that hook and could not really see anything change. I tried running a dump and die inside the hook but could not get that to trigger.

    In the end I did end up doing what @owenbush suggested and I just swapped the no op plugin in, because our use case all of the date for the recurring events are always custom, and therefore we never want the reconciliation to run. Now I am just dealing with the fact that the warning still pops up when someone saves any of the event series, and if I run the hook to remove the date customizations, it stops that warning from showing but doesn't allow for the user to actually save the series. That is where I am stuck right now.

  • πŸ‡ΊπŸ‡ΈUnited States dustinleblanc Ithaca, NY

    annnnndd as usual, turns out saving the form is giving us issues because we customized the form...ignore that part.

Production build 0.71.5 2024