protected function DefaultDateRecurOccurrenceHandler::getOccurrencesForCacheStorage in Recurring Dates Field 8
1 call to DefaultDateRecurOccurrenceHandler::getOccurrencesForCacheStorage()
- DefaultDateRecurOccurrenceHandler::onSave in src/
Plugin/ DateRecurOccurrenceHandler/ DefaultDateRecurOccurrenceHandler.php - React when a field item is saved.
File
- src/
Plugin/ DateRecurOccurrenceHandler/ DefaultDateRecurOccurrenceHandler.php, line 199
Class
- DefaultDateRecurOccurrenceHandler
- Provides the default occurrence handler.
Namespace
Drupal\date_recur\Plugin\DateRecurOccurrenceHandlerCode
protected function getOccurrencesForCacheStorage() {
// Get storage format from settings.
$storageFormat = $this->item
->getDateStorageFormat();
if (!$this->isRecurring) {
if (empty($this->item->end_date)) {
$this->item->end_date = $this->item->start_date;
}
return [
[
'value' => DateRecurRRule::massageDateValueForStorage($this->item->start_date, $storageFormat),
'end_value' => DateRecurRRule::massageDateValueForStorage($this->item->end_date, $storageFormat),
],
];
}
else {
$until = new \DateTime();
$until
->add(new \DateInterval($this->item
->getFieldDefinition()
->getSetting('precreate')));
return $this->rruleObject
->getOccurrencesForCacheStorage($until, $storageFormat);
}
}