/[drupal]/contributions/modules/node_import/import_cck.inc
ViewVC logotype

Diff of /contributions/modules/node_import/import_cck.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.3, Thu Apr 6 10:28:05 2006 UTC revision 1.4, Fri Apr 14 22:08:13 2006 UTC
# Line 34  function content_node_import_prepare(&$n Line 34  function content_node_import_prepare(&$n
34    foreach ($content_type->fields as $field) {    foreach ($content_type->fields as $field) {
35      if (strpos($field['widget']['type'], 'nodereference') === 0) {//nodereference node: query nid of the referenced node      if (strpos($field['widget']['type'], 'nodereference') === 0) {//nodereference node: query nid of the referenced node
36        $referenced_nodes = array();        $referenced_nodes = array();
37        $sql = "select title from {node} where title sounds like '%s'";        $sql = "select nid, title from {node} where title sounds like '%s'";
38        $result = db_query($sql, $node->$field['field_name']);        $result = db_query($sql, $node->$field['field_name']);
39        $record_found = db_fetch_object($result);        $record_found = db_fetch_object($result);
40    
41        if ($record_found) {        if ($record_found) {
   
42          if ($field['multiple']) {          if ($field['multiple']) {
43            $node->$field['field_name'] = array('title' => array(0 => $record_found->title));            $node_field = array(0 => array('nid' => $record_found->nid));
44          } else {          } else {
45            $node->$field['field_name'] = array('title' => $record_found->title);            $node_field = array('nid' => $record_found->nid);
46          }          }
         //update the node field with proper info (nid(s) of referenced nodes)  
         nodereference_widget('submit', $node, $field);  
47        } else {        } else {
48          $node->$field['field_name'] = array();          $node_field = array();
49        }        }
50          $node->$field['field_name'] = $node_field;
51    
52      } else {//default node types: add value to array w/ key 'value'      } else {//default node types: add value to array w/ key 'value'
53        $thisval = $node->$field['field_name'];        $thisval = $node->$field['field_name'];

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.2