You are here

function feeds_imagegrabber_node_update in Feeds Image Grabber 7

Implements hook_node_update().

1 call to feeds_imagegrabber_node_update()
feeds_imagegrabber_node_insert in ./feeds_imagegrabber.module
Implements hook_node_insert().

File

./feeds_imagegrabber.module, line 98
Grabs images for items imported using the feeds module.

Code

function feeds_imagegrabber_node_update($node) {
  if ($importer_id = feeds_get_importer_id($node->type)) {
    if (isset($node->feeds_imagegrabber['enabled']) && $node->feeds_imagegrabber['enabled']) {
      $settings = array(
        'enabled' => $node->feeds_imagegrabber['enabled'],
        'id_class' => $node->feeds_imagegrabber['id_class'],
        'id_class_desc' => $node->feeds_imagegrabber['id_class_desc'],
        'exec_time' => $node->feeds_imagegrabber['exec_time'],
        'feeling_lucky' => $node->feeds_imagegrabber['feeling_lucky'],
      );
      db_merge('feeds_imagegrabber')
        ->key(array(
        'feed_nid' => $node->nid,
      ))
        ->fields($settings)
        ->execute();
    }
    else {
      db_update('feeds_imagegrabber')
        ->fields(array(
        'enabled' => 0,
      ))
        ->condition('feed_nid', $node->nid)
        ->execute();
    }
  }
}