You are here

protected function DateRecurBasicFormatter::getOccurrences in Recurring Dates Field 3.0.x

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldFormatter/DateRecurBasicFormatter.php \Drupal\date_recur\Plugin\Field\FieldFormatter\DateRecurBasicFormatter::getOccurrences()
  2. 3.x src/Plugin/Field/FieldFormatter/DateRecurBasicFormatter.php \Drupal\date_recur\Plugin\Field\FieldFormatter\DateRecurBasicFormatter::getOccurrences()
  3. 3.1.x src/Plugin/Field/FieldFormatter/DateRecurBasicFormatter.php \Drupal\date_recur\Plugin\Field\FieldFormatter\DateRecurBasicFormatter::getOccurrences()

Get the occurrences for a field item.

Occurrences are abstracted out to make it easier for extending formatters to change.

Parameters

\Drupal\date_recur\Plugin\Field\FieldType\DateRecurItem $item: A field item.

int $maxOccurrences: Maximum number of occurrences to render.

Return value

\Drupal\date_recur\DateRange[] A render array.

1 call to DateRecurBasicFormatter::getOccurrences()
DateRecurBasicFormatter::viewItem in src/Plugin/Field/FieldFormatter/DateRecurBasicFormatter.php
Generate the output appropriate for a field item.

File

src/Plugin/Field/FieldFormatter/DateRecurBasicFormatter.php, line 447

Class

DateRecurBasicFormatter
Basic recurring date formatter.

Namespace

Drupal\date_recur\Plugin\Field\FieldFormatter

Code

protected function getOccurrences(DateRecurItem $item, $maxOccurrences) : array {
  $start = new \DateTime('now');
  return $item
    ->getHelper()
    ->getOccurrences($start, NULL, $maxOccurrences);
}