You are here

public function FeedsFeedNodeProcessor::setTargetElement in Feeds 7

Same name and namespace in other branches
  1. 6 plugins/FeedsFeedNodeProcessor.inc \FeedsFeedNodeProcessor::setTargetElement()

Override setTargetElement to operate on a target item that is a node.

Overrides FeedsProcessor::setTargetElement

File

plugins/FeedsFeedNodeProcessor.inc, line 150
Class definition of FeedsFeedNodeProcessor.

Class

FeedsFeedNodeProcessor
Creates *feed* nodes from feed items. The difference to FeedsNodeProcessor is that this plugin only creates nodes that are feed nodes themselves.

Code

public function setTargetElement($target_node, $target_element, $value) {
  if ($target_element == 'source') {

    // Get the class of the feed node importer's fetcher and set the source
    // property. See feeds_node_update() how $node->feeds gets stored.
    $class = get_class($this
      ->feedNodeImporter()->fetcher);
    $target_node->feeds[$class]['source'] = $value;
  }
  elseif ($target_element == 'body') {
    $target_node->teaser = $value;
    $target_node->body = $value;
  }
  elseif (in_array($target_element, array(
    'title',
    'status',
    'created',
  ))) {
    $target_node->{$target_element} = $value;
  }
}