0

I'm importing an iCal feed using iCal Parser. I've actually tried a few other parsers including Date API iCal parser, iCalCreator parser, but every one seems to have the same set of sources. How can I access all the other fields in the feed, specifically, the ORGANIZER: ORGANIZER;CN=name@email.com:mailto:name@email.com?

I've tried to hook into hook_feeds_parser_sources_alter, and setting up a new callback function. Like this:

/**
* Implements hook_feeds_parser_sources_alter().
*/
function my_hook_feeds_parser_sources_alter(&$sources, $content_type) {
$sources['field_importer_reference'] = array(
'name' => t('Organizer'),
'description' => t('The name of the organizer.'),
'callback' => 'my_hook_get_organizer',
);
}
function my_hook_get_organizer(FeedsSource $source) {
dpm($source->CN);// this doesn't do anything...
return $source->CN;
}

I get this message when I try to import: Date iCal does not recognize the "Organizer" Mapping Source, and must skip it.

1

In writing the question I came across the answer and want to share. I was using the wrong hook. Instead I used:

function my_hook_date_ical_mapping_sources_alter(&$sources) {
// Add the "ORGANIZER" iCal property to the mapping sources.
$sources['ORGANIZER'] = array(
'name' => t('Organizer'),
'description' => t('The ORGANIZER property.'),
'date_ical_parse_handler' => 'parseTextProperty',
);
// Add "ORGANIZER:CN" parameter to the mapping sources.
$sources['ORGANIZER:CN'] = array(
'name' => t('Organizer: CN'),
'description' => t("The CN parameter of the ORGANIZER property: the organizer's Common Name."),
'date_ical_parse_handler' => 'parsePropertyParameter',
);
}

Note that I'm pulling both the Contact's Name and the mailto field.

This is a hook provided by the date_ical module. I basically copied the example found there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.