You are here

public function DefaultDateRecurOccurrenceHandler::init in Recurring Dates Field 8

Init the handler with a field item.

Parameters

\Drupal\date_recur\Plugin\Field\FieldType\DateRecurItem $item:

Overrides DateRecurOccurrenceHandlerInterface::init

File

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

Class

DefaultDateRecurOccurrenceHandler
Provides the default occurrence handler.

Namespace

Drupal\date_recur\Plugin\DateRecurOccurrenceHandler

Code

public function init(DateRecurItem $item) {
  $this->item = $item;
  if (!empty($item->rrule)) {
    $this->rruleObject = new DateRecurRRule($item->rrule, $item->start_date, $item->end_date, $item->timezone);
    $this->isRecurring = TRUE;
  }
  else {
    $this->isRecurring = FALSE;
  }
  $this->tableName = $this
    ->getOccurrenceCacheStorageTableName($this->item
    ->getFieldDefinition()
    ->getFieldStorageDefinition());
}