private function SmartDateRecurrenceFormatter::findNextInstance in Smart Date 3.3.x
Same name and namespace in other branches
- 8.2 modules/smart_date_recur/src/Plugin/Field/FieldFormatter/SmartDateRecurrenceFormatter.php \Drupal\smart_date_recur\Plugin\Field\FieldFormatter\SmartDateRecurrenceFormatter::findNextInstance()
- 3.x modules/smart_date_recur/src/Plugin/Field/FieldFormatter/SmartDateRecurrenceFormatter.php \Drupal\smart_date_recur\Plugin\Field\FieldFormatter\SmartDateRecurrenceFormatter::findNextInstance()
- 3.0.x modules/smart_date_recur/src/Plugin/Field/FieldFormatter/SmartDateRecurrenceFormatter.php \Drupal\smart_date_recur\Plugin\Field\FieldFormatter\SmartDateRecurrenceFormatter::findNextInstance()
- 3.1.x modules/smart_date_recur/src/Plugin/Field/FieldFormatter/SmartDateRecurrenceFormatter.php \Drupal\smart_date_recur\Plugin\Field\FieldFormatter\SmartDateRecurrenceFormatter::findNextInstance()
- 3.2.x modules/smart_date_recur/src/Plugin/Field/FieldFormatter/SmartDateRecurrenceFormatter.php \Drupal\smart_date_recur\Plugin\Field\FieldFormatter\SmartDateRecurrenceFormatter::findNextInstance()
- 3.4.x modules/smart_date_recur/src/Plugin/Field/FieldFormatter/SmartDateRecurrenceFormatter.php \Drupal\smart_date_recur\Plugin\Field\FieldFormatter\SmartDateRecurrenceFormatter::findNextInstance()
Helper function to find the next instance from now in a provided range.
1 call to SmartDateRecurrenceFormatter::findNextInstance()
- SmartDateRecurrenceFormatter::viewElements in modules/
smart_date_recur/ src/ Plugin/ Field/ FieldFormatter/ SmartDateRecurrenceFormatter.php
File
- modules/
smart_date_recur/ src/ Plugin/ Field/ FieldFormatter/ SmartDateRecurrenceFormatter.php, line 282
Class
- SmartDateRecurrenceFormatter
- Plugin for a recurrence-optimized formatter for 'smartdate' fields.
Namespace
Drupal\smart_date_recur\Plugin\Field\FieldFormatterCode
private function findNextInstance(array $instances) {
$next_index = -1;
$time = time();
foreach ($instances as $index => $instance) {
if ($instance->value > $time) {
$next_index = $index;
break;
}
}
return $next_index;
}