function date_feeds_set_target in Feeds 6
Same name and namespace in other branches
- 7.2 mappers/date.inc \date_feeds_set_target()
- 7 mappers/date.inc \date_feeds_set_target()
Implementation of hook_feeds_set_target().
@todo Support array of values for dates.
Parameters
$node: The target node.
$field_name: The name of field on the target node to map to.
$feed_element: The value to be mapped. Should be either a (flexible) date string or a FeedsDateTimeElement object.
1 string reference to 'date_feeds_set_target'
- date_feeds_node_processor_targets_alter in mappers/
date.inc - Implementation of hook_feeds_node_processor_targets_alter().
File
- mappers/
date.inc, line 51 - On behalf implementation of Feeds mapping API for date
Code
function date_feeds_set_target($node, $target, $feed_element) {
list($field_name, $sub_field) = explode(':', $target);
if (!$feed_element instanceof FeedsDateTimeElement) {
if (is_array($feed_element)) {
$feed_element = $feed_element[0];
}
// Empty string means no time - so do not set any!
if (!is_numeric($feed_element) && !strtotime($feed_element)) {
return;
}
if ($sub_field == 'end') {
$feed_element = new FeedsDateTimeElement(NULL, $feed_element);
}
else {
$feed_element = new FeedsDateTimeElement($feed_element, NULL);
}
}
$feed_element
->buildDateField($node, $field_name);
}