function date_ical_feeds_set_rrule in Date iCal 7.2
Same name and namespace in other branches
- 7.3 date_ical.module \date_ical_feeds_set_rrule()
Callback specified in date_ical_feeds_processor_targets_alter() for RRULEs.
Parameters
$source: The FeedsSource object.
$entity: The node that's being built from the iCal element that's being parsed.
$target: The machine name of the field into which this RRULE shall be parsed, with ":rrule" appended to the end.
$feed_element: The RRULE string (with optional EXDATEs and RDATEs separated by \n).
1 string reference to 'date_ical_feeds_set_rrule'
File
- ./
date_ical.module, line 234 - Adds ical functionality to Views, and an iCal parser to Feeds.
Code
function date_ical_feeds_set_rrule($source, $entity, $target, $feed_element) {
if (empty($feed_element)) {
// Make sure that VEVENTs which have no RRULE aren't given repeating dates.
return;
}
// Add the RRULE value to the field in $entity.
list($field_name, $trash) = explode(':', $target, 2);
module_load_include('inc', 'date_api', 'date_api_ical');
$info = field_info_field($field_name);
foreach ($entity->{$field_name} as $lang => $field_array) {
// Add the multiple date values that Date Repeat Field uses to represent recurring dates.
$values = date_ical_build_repeating_dates($feed_element, NULL, $info, $field_array[0]);
foreach ($values as $key => $value) {
$entity->{$field_name}[$lang][$key] = $value;
}
}
}