public function FeedsParser::getSourceElement in Feeds 7.2
Same name and namespace in other branches
- 6 plugins/FeedsParser.inc \FeedsParser::getSourceElement()
- 7 plugins/FeedsParser.inc \FeedsParser::getSourceElement()
Get an element identified by $element_key of the given item. The element key corresponds to the values in the array returned by FeedsParser::getMappingSources().
This method is invoked from FeedsProcessor::map() when a concrete item is processed.
Parameters
$batch: FeedsImportBatch object containing the sources to be mapped from.
$element_key: The key identifying the element that should be retrieved from $source
Return value
The source element from $item identified by $element_key.
See also
FeedsCSVParser::getSourceElement()
Related topics
1 call to FeedsParser::getSourceElement()
- FeedsCSVParser::getSourceElement in plugins/
FeedsCSVParser.inc - Override parent::getSourceElement() to use only lower keys.
1 method overrides FeedsParser::getSourceElement()
- FeedsCSVParser::getSourceElement in plugins/
FeedsCSVParser.inc - Override parent::getSourceElement() to use only lower keys.
File
- plugins/
FeedsParser.inc, line 157 - Contains FeedsParser and related classes.
Class
- FeedsParser
- Abstract class, defines interface for parsers.
Code
public function getSourceElement(FeedsSource $source, FeedsParserResult $result, $element_key) {
switch ($element_key) {
case 'parent:uid':
if ($source->feed_nid && ($node = node_load($source->feed_nid))) {
return $node->uid;
}
break;
case 'parent:nid':
return $source->feed_nid;
}
$item = $result
->currentItem();
return isset($item[$element_key]) ? $item[$element_key] : '';
}