You are here

function _feeds_nodeapi_node_processor in Feeds 6

Handles FeedsNodeProcessor specific nodeapi operations.

Related topics

1 call to _feeds_nodeapi_node_processor()
feeds_nodeapi in ./feeds.module
Implementation of hook_nodeapi().

File

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

Code

function _feeds_nodeapi_node_processor($node, $op) {
  switch ($op) {
    case 'load':
      if ($result = db_fetch_object(db_query("SELECT imported, guid, url, feed_nid FROM {feeds_node_item} WHERE nid = %d", $node->nid))) {
        $node->feeds_node_item = $result;
      }
      break;
    case 'insert':
      if (isset($node->feeds_node_item)) {
        $node->feeds_node_item->nid = $node->nid;
        drupal_write_record('feeds_node_item', $node->feeds_node_item);
      }
      break;
    case 'update':
      if (isset($node->feeds_node_item)) {
        $node->feeds_node_item->nid = $node->nid;
        drupal_write_record('feeds_node_item', $node->feeds_node_item, 'nid');
      }
      break;
    case 'delete':
      db_query("DELETE FROM {feeds_node_item} WHERE nid = %d", $node->nid);
      break;
  }
}