Index: includes/views/content.views_convert.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cck/includes/views/Attic/content.views_convert.inc,v
retrieving revision 1.1.2.4
diff -u -p -r1.1.2.4 content.views_convert.inc
--- includes/views/content.views_convert.inc	6 Oct 2008 15:11:39 -0000	1.1.2.4
+++ includes/views/content.views_convert.inc	24 Apr 2009 19:22:34 -0000
@@ -9,63 +9,44 @@
 /**
  * Implementation of hook_views_convert().
  *
- * Intervene to convert field values from the Views 1 format to the
- * Views 2 format. Intervene only if $view->add_item() won't produce
- * the right results, usually needed to set field options or values.
+ * Intervene to convert field values from the Views 1 format to the Views 2
+ * format. Intervene only if $view->add_item() won't produce the right results,
+ * usually needed to set field options or values.
  */
-function content_views_convert($display, $type, &$view, $views_field) {
-  static $views_fields;
-
-  if (empty($views_fields)) {
-    $views_fields = array();
-    $types = content_types();
-    foreach ($types as $ctype) {
-      foreach ($ctype['fields'] as $field) {
-        $module = $field['module'];
-        $result = module_invoke($module, 'field_settings', 'views data', $field);
-        if (empty($result)) {
+function content_views_convert($display, $type, &$view, $field, $id = NULL) {
+  static $content_fields;
+  if (!isset($content_fields)) {
+    $content_fields = array();
+    $content_types = content_types();
+    foreach ($content_types as $content_type) {
+      foreach ($content_type['fields'] as $content_field) {
+        $data = module_invoke($content_field['module'], 'field_settings', 'views data', $content_field);
+        if (empty($data)) {
           // The views field name had the column name appended,
           // like field_name_value or field_username_uid.
-          $column = array_shift(array_keys($field['columns']));
-          $views_fields[$field['field_name'] .'_'. $column] = $field;
+          $content_fields[] = $content_field['field_name'] .'_'. key($content_field['columns']);
         }
       }
     }
   }
-
-  // Is this a field that CCK should handle? If not, return.
-  if (!in_array($views_field['field'], array_keys($views_fields))) {
-    return;
-  }
-
-  // Now update values, options, etc. to those selected in the imported view.
   switch ($type) {
     case 'field':
-      $view->display[$display]->display_options['fields'][$views_field['field']]['format'] = $views_field['options'];
-      if ($views_field['handler'] == 'content_views_field_handler_group') {
-        $view->display[$display]->display_options['fields'][$views_field['field']]['multiple']['group'] = 1;
-      }
-      else {
-        $view->display[$display]->display_options['fields'][$views_field['field']]['multiple']['group'] = 0;
+      if (in_array($field['field'], $content_fields)) {
+        $view->set_item_option($display, 'field', $id, 'format', $field['options']);
+        $view->set_item_option($display, 'field', $id, 'multiple', array('group' => $field['handler'] == 'content_views_field_handler_group'));
       }
-      return;
-
+      break;
     case 'filter':
       // TODO
-      return;
-
+      break;
     case 'exposed_filter':
       // TODO
-      return;
-
-    case 'argument':
-      // TODO
-      return;
-
+      break;
     case 'sort':
       // TODO
       break;
-
+    case 'argument':
+      // TODO
+      break;
   }
-  return;
-}
\ No newline at end of file
+}
