Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
drupal.org
date_ical
Commits
e7c93074
Commit
e7c93074
authored
Aug 25, 2014
by
cdmo
Committed by
Robert Rollins
Aug 25, 2014
Browse files
Issue #2325649: Added hook for modules to create custom mapping sources.
This patch is courtesy of Drupal user cdmo.
parent
fda25132
Changes
2
Hide whitespace changes
Inline
Side-by-side
date_ical.api.php
View file @
e7c93074
...
...
@@ -221,3 +221,32 @@ function hook_date_ical_import_timezone_alter(&$tzid, $context) {
$tzid
=
'America/New_York'
;
}
}
/**
* Add an additional custom source to be mapped by a feed.
*
* This is useful when you need to map fields from an iCal feed which
* the Date iCal module does not currently support.
*
* @param array $sources
* An associative array containing the source's properties, as follows:
* name: The name that will appear in the feed importer Mapping page.
* description: The description of this field shown in the Mapping page.
* date_ical_parse_handler: The function in the ParserVcalendar class
* which should be used to parse this iCal property into a Drupal field.
*/
function
hook_date_ical_mapping_sources_alter
(
&
$sources
)
{
// Example of what might be done with this alter hook:
// Add the "ATTENDEE" iCal property to the mapping sources.
$sources
[
'ATTENDEE'
]
=
array
(
'name'
=>
t
(
'Attendee'
),
'description'
=>
t
(
'The ATTENDEE property.'
),
'date_ical_parse_handler'
=>
'parseTextProperty'
,
);
// Add "ATTENDEE:CN" parameter to the mapping sources.
$sources
[
'ATTENDEE:CN'
]
=
array
(
'name'
=>
t
(
'Attendee: CN'
),
'description'
=>
t
(
"The CN parameter of the ATTENDEE property: the attendee's Common Name."
),
'date_ical_parse_handler'
=>
'parsePropertyParameter'
,
);
}
includes/DateiCalFeedsParser.inc
View file @
e7c93074
...
...
@@ -196,6 +196,10 @@ class DateiCalFeedsParser extends FeedsParser {
'description'
=>
t
(
'The CATEGORIES property. Catagories that describe the event, which can be imported into taxonomy terms.'
),
'date_ical_parse_handler'
=>
'parseMultivalueProperty'
,
);
// Allow other modules to add custom source fields.
drupal_alter
(
'date_ical_mapping_sources'
,
$sources
);
return
$sources
;
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment