You are here

function feeds_node_presave in Feeds 7.2

Same name and namespace in other branches
  1. 8.2 feeds.module \feeds_node_presave()
  2. 7 feeds.module \feeds_node_presave()

Implements hook_node_presave().

Related topics

File

./feeds.module, line 742
Feeds - basic API functions and hook implementations.

Code

function feeds_node_presave($node) {

  // Populate $node->title and $node->feed from result of validation phase.
  $last_title =& drupal_static('feeds_node_last_title');
  $last_feeds =& drupal_static('feeds_node_last_feeds');
  if (empty($node->title) && !empty($last_title)) {
    $node->title = $last_title;
  }
  if (!empty($last_feeds)) {
    $node->feeds = $last_feeds;
  }
  $last_title = NULL;
  $last_feeds = NULL;

  // Update "changed" value if there was mapped to that.
  if (isset($node->feeds_item->node_changed)) {
    $node->changed = $node->feeds_item->node_changed;
  }
}