Commit 3b5e2adf authored by Karl Yoder's avatar Karl Yoder
Browse files

Issue #3316054 by kyoder: Prevent original entity date from being duped

parent 1c1bb6ed
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -41,6 +41,9 @@ class EntityRepeatEventSubscriber implements EventSubscriberInterface {
    // Get date occurrences.
    $dates = $helper->getOccurrences();

    // Remove first date so we don't duplicate the original entity (same date).
    array_shift($dates);

    // Generate the entities.
    _entity_repeat_generate_entities($entity, $helper, $dates);
  }
@@ -51,8 +54,6 @@ class EntityRepeatEventSubscriber implements EventSubscriberInterface {
  public static function getSubscribedEvents(): array {
    return [
      DateRecurEvents::FIELD_VALUE_SAVE => ['onSave'],
      DateRecurEvents::FIELD_ENTITY_DELETE => ['onEntityDelete'],
      DateRecurEvents::FIELD_REVISION_DELETE => ['onEntityRevisionDelete'],
    ];
  }

+2 −2
Original line number Diff line number Diff line
@@ -107,8 +107,8 @@ class EntityRepeatWidget extends parentAlias {
      $form_state->setError($element['end'], t('End date must be provided.'));
    }

    // A limit to repeats must be provided if repeating more than once.
    if ($mode != 'once') {
    // A limit to repeats must be provided if repeating more than once and not a specific number of days (multiday).
    if ($mode != 'once' && $mode != 'multiday') {
      // Date must be provided if ends mode is date.
      if ($ends_mode == 'date' && !$ends_date instanceof DrupalDateTime) {
        $form_state->setError($element['ends_date'], t('Date to end repeats must be provided.'));