Skip to content
Snippets Groups Projects
Commit 1efc6cfe authored by Owen Bush's avatar Owen Bush
Browse files

If eventseries not moderated, recreated the eventinstances straight away...

If eventseries not moderated, recreated the eventinstances straight away rather than waiting for the series to be published
parent c66cfdb6
No related branches found
No related tags found
No related merge requests found
...@@ -222,11 +222,12 @@ function template_preprocess_eventseries(array &$variables) { ...@@ -222,11 +222,12 @@ function template_preprocess_eventseries(array &$variables) {
function recurring_events_eventseries_presave(EntityInterface $entity) { function recurring_events_eventseries_presave(EntityInterface $entity) {
$original = $entity->original; $original = $entity->original;
$creation_service = \Drupal::service('recurring_events.event_creation_service'); $creation_service = \Drupal::service('recurring_events.event_creation_service');
$moderated = $entity->hasField('moderation_state');
// If the eventseries is being published, or created for the first time then // If the eventseries is being published, or created for the first time then
// there may be date recurrence changes that need to be converted into new // there may be date recurrence changes that need to be converted into new
// eventinstance entities. // eventinstance entities.
if ($entity->isPublished() || $entity->isNew()) { if ($entity->isPublished() || $entity->isNew() || !$moderated) {
if ($entity->isDefaultTranslation()) { if ($entity->isDefaultTranslation()) {
$creation_service->saveEvent($entity, $original); $creation_service->saveEvent($entity, $original);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment