You are here

private function SmartDateProcessor::updateEntry in Smart Date 3.2.x

Same name and namespace in other branches
  1. 8.2 src/Plugin/FullcalendarViewProcessor/SmartDateProcessor.php \Drupal\smart_date\Plugin\FullcalendarViewProcessor\SmartDateProcessor::updateEntry()
  2. 3.x src/Plugin/FullcalendarViewProcessor/SmartDateProcessor.php \Drupal\smart_date\Plugin\FullcalendarViewProcessor\SmartDateProcessor::updateEntry()
  3. 3.0.x src/Plugin/FullcalendarViewProcessor/SmartDateProcessor.php \Drupal\smart_date\Plugin\FullcalendarViewProcessor\SmartDateProcessor::updateEntry()
  4. 3.1.x src/Plugin/FullcalendarViewProcessor/SmartDateProcessor.php \Drupal\smart_date\Plugin\FullcalendarViewProcessor\SmartDateProcessor::updateEntry()
  5. 3.3.x src/Plugin/FullcalendarViewProcessor/SmartDateProcessor.php \Drupal\smart_date\Plugin\FullcalendarViewProcessor\SmartDateProcessor::updateEntry()
  6. 3.4.x src/Plugin/FullcalendarViewProcessor/SmartDateProcessor.php \Drupal\smart_date\Plugin\FullcalendarViewProcessor\SmartDateProcessor::updateEntry()

Helper function to update the FCV-created data arrary.

Parameters

array $entry: The original data, created by Fullcalendar View.

array $row_data: Data that will be used to update the calendar entry.

array $format: Formatting options from the specified Smart Date Format.

1 call to SmartDateProcessor::updateEntry()
SmartDateProcessor::process in src/Plugin/FullcalendarViewProcessor/SmartDateProcessor.php
Process retrieved values before being passed to Fullcalendar.

File

src/Plugin/FullcalendarViewProcessor/SmartDateProcessor.php, line 111

Class

SmartDateProcessor
Smart Date plugin.

Namespace

Drupal\smart_date\Plugin\FullcalendarViewProcessor

Code

private function updateEntry(array &$entry, array $row_data, array $format) {
  $start = $row_data['value'];
  $end = $row_data['end_value'];
  if (empty($entry) || empty($start) || empty($end) || !ctype_digit($start) || !ctype_digit($end)) {
    return FALSE;
  }
  $timezone = NULL;
  if (isset($row_data['timezone']) && $row_data['timezone']) {
    $timezone = $row_data['timezone'];
  }

  // Check for all day events.
  if (SmartDateTrait::isAllDay($start, $end, $timezone)) {
    $entry['start'] = date('Y-m-d', $start);

    // The end date is inclusive for a all day event in full calendar,
    // which is not what we want. So we need one day offset.
    $entry['end'] = date('Y-m-d', $end + 60 * 60 * 24);
    $entry['allDay'] = TRUE;
  }
  else {
    $entry['start'] = date(DATE_ATOM, $start);
    $entry['end'] = date(DATE_ATOM, $end);
    $entry['allDay'] = FALSE;
  }

  // Append the id with necessary additional data.
  if (!empty($row_data['rrule'])) {
    $entry['eid'] = $row_data['id'] . '-R-' . $row_data['rrule'] . '-I-' . $row_data['rrule_index'];
  }
  elseif (isset($row_data['delta'])) {
    $entry['eid'] = $row_data['id'] . '-D-' . $row_data['delta'];
  }
}