You are here

public function DateIcalIcalcreatorParser::formatRrule in Date iCal 7.2

Format RRULEs, which specify when and how often the event is repeated.

Return value

An RRULE string, with any EXDATE and RDATE values appended, separated by \n. This is to make the RRULE compatible with date_repeat_split_rrule().

File

includes/DateIcalIcalcreatorParser.inc, line 327
Classes implementing Date iCal's iCalcreator-based parser functionality.

Class

DateIcalIcalcreatorParser
@file Classes implementing Date iCal's iCalcreator-based parser functionality.

Code

public function formatRrule($property_key, $property, DateIcalIcalcreatorComponent $item, DateIcalParserResult $result, FeedsSource $source) {
  $context = get_defined_vars();

  // Allow modules to alter the RRULE before it's mapped to the target.
  drupal_alter('date_ical_feeds_object', $property, $context);

  // RRULEs must have an INTERVAL, or Date Repeat will throw errors.
  if (!isset($property['value']['INTERVAL'])) {
    $property['value']['INTERVAL'] = '1';
  }
  $item
    ->setRrule($property);
  $rrule = $item
    ->getRrule();
  $exdate = $item
    ->getExdate();
  $rdate = $item
    ->getRdate();
  return trim("{$rrule}\n{$exdate}\n{$rdate}");
}