You are here

public function DefaultDateRecurOccurrenceHandler::onSaveMaxDelta in Recurring Dates Field 8

React after a field item list was saved.

This is used to clear obsolete deltas.

Parameters

int $field_delta The highest existing field delta.:

Overrides DateRecurOccurrenceHandlerInterface::onSaveMaxDelta

File

src/Plugin/DateRecurOccurrenceHandler/DefaultDateRecurOccurrenceHandler.php, line 236

Class

DefaultDateRecurOccurrenceHandler
Provides the default occurrence handler.

Namespace

Drupal\date_recur\Plugin\DateRecurOccurrenceHandler

Code

public function onSaveMaxDelta($field_delta) {
  $q = $this->database
    ->delete($this->tableName);
  $q
    ->condition('entity_id', $this->item
    ->getEntity()
    ->id());
  $q
    ->condition('revision_id', $this->item
    ->getEntity()
    ->getRevisionId());
  $q
    ->condition('field_delta', $field_delta, '>');
  $q
    ->execute();
}