How can one modify the value of an ical field (in my case the Location field) before importing it?
I want to do this because the ical field is mapped to a taxonomy field in Drupal. The ics file is the following
BEGIN:VCALENDAR
VERSION:2.0
PRODID:shapes
BEGIN:VTIMEZONE
TZID:GTB Standard Time
BEGIN:STANDARD
DTSTART:20161002T040000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYHOUR=4;BYMINUTE=0;BYMONTH=10
TZNAME:GTB Standard Time
TZOFFSETFROM:+0300
TZOFFSETTO:+0200
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:20160301T030000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYHOUR=3;BYMINUTE=0;BYMONTH=3
TZNAME:GTB Daylight Time
TZOFFSETFROM:+0200
TZOFFSETTO:+0300
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
DESCRIPTION:
DTEND;VALUE=DATE:20170811
DTSTAMP:20170809T125455Z
DTSTART;VALUE=DATE:20170809
LOCATION:Building 11
SEQUENCE:0
SUMMARY:Morning
UID:96b6fe5b-4092-40f8-9ed3-76909bd2d778
END:VEVENT
END:VCALENDAR
What I want is, instead of LOCATION:Building 11
, to have LOCATION:Room #11
, because the terms on my taxonomy are of the form "Room #number".
I don't know if I'm thinking correctly about it but I should modify this part of date_ical.api.php
? What would I have to add there?
/**
* Alter the parsed data for an event imported from an iCal feed.
*
* @param array $data
* An associative array of field data that represents an imported event.
* @param array $context
* An associative array of context, with the following keys and values:
* - 'calendar': The iCalcreator vcalendar parent object of this component.
* - 'source': FeedsSource object for this Feed.
* - 'fetcher_result': The FeedsFetcherResult object for this Feed.
*/
function hook_date_ical_import_post_parse_alter(&$data, $context) {
// Example of what might be done with this alter hook.
if (!empty($context['calendar']->xprop['X-WR-CALNAME']['value'])) {
// Do something with the calendar name....
}
}
I'd appreciate any help, thanks!
Closed: outdated
3.9
iCal Import
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
No activities found.