Skip to content
Snippets Groups Projects
Commit 2ba69d6a authored by Chris Leppanen's avatar Chris Leppanen
Browse files

Issue #1070604 by Bobík: Added Feed's nid in mappings.

parent bc5bc63a
No related branches found
No related tags found
No related merge requests found
......@@ -104,6 +104,10 @@ abstract class FeedsParser extends FeedsPlugin {
'name' => t('Feed node: User ID'),
'description' => t('The feed node author uid.'),
);
$sources['parent:nid'] = array(
'name' => t('Feed node: Node ID'),
'description' => t('The feed node nid.'),
);
return $sources;
}
......@@ -129,11 +133,18 @@ abstract class FeedsParser extends FeedsPlugin {
* @see FeedsCSVParser::getSourceElement()
*/
public function getSourceElement(FeedsSource $source, FeedsParserResult $result, $element_key) {
if ($element_key == 'parent:uid' &&
$source->feed_nid &&
($node = node_load($source->feed_nid))) {
return $node->uid;
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] : '';
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment