When clicking link "Content Types" in admin a warning is displayed in the message area above listing of content types:

warning: Invalid argument supplied for foreach() in /var/www/drupal5/sites/all/modules/i18n/experimental/i18nsync.module on line 47.

the afflicting code is:

      // Each set provides title and options. We build a big checkboxes control for it to be
      // saved as an array. Special themeing for group titles.
      foreach (i18nsync_node_available_fields($type) as $group => $data) {
        $title = $data['#title'];
 -->>   foreach ($data['#options'] as $field => $name) {
          $form['workflow']['i18n']['i18nsync_nodeapi'][$field] = array(
            '#group_title' => $title,
            '#title' => $name,
            '#type' => 'checkbox',
            '#default_value' => in_array($field, $current),
            '#theme' => 'i18nsync_workflow_checkbox',
          );
          $title = '';  
        }     
      }

I don't know if it has anything to do with it, but so far I have not done any translations. I have only enabled a 2nd language and imported .po file with UI translations. It might be that when I have translated something this goes away, which may is the case why it hasn't been reported - so I thought I better do so before it's "sweeped under the carpet" as I don't think it should give this warning.

CommentFileSizeAuthor
#5 i18nsync.module.patch1.61 KBSoren Jones

Comments

vikingew’s picture

Correction: It's when you click "edit" link on content types overview page, like for Page, the warning is then displayed on top of the Page page.

vikingew’s picture

Status: Active » Needs review

Ok I have solved this one, it's due to CCK sets may lack fields (#options element) in the passed array. Sorry I can't provide a real patch but it's an easy one to do manually.

in i18nsync.module, starting with line 43

      // Each set provides title and options. We build a big checkboxes control for it to be
      // saved as an array. Special themeing for group titles.
      foreach (i18nsync_node_available_fields($type) as $group => $data) {
-        $title = $data['#title'];
-        foreach ($data['#options'] as $field => $name) {
-          $form['workflow']['i18n']['i18nsync_nodeapi'][$field] = array(
-            '#group_title' => $title,
-            '#title' => $name,
-            '#type' => 'checkbox',
-            '#default_value' => in_array($field, $current),
-            '#theme' => 'i18nsync_workflow_checkbox',
-          );
-          $title = '';  
-        }     
+        if (array_key_exists('#options', $data)) {
+		   $title = $data['#title'];
+		   foreach ($data['#options'] as $field => $name) {
+		     $form['workflow']['i18n']['i18nsync_nodeapi'][$field] = array(
+			   '#group_title' => $title,
+			   '#title' => $name,
+			   '#type' => 'checkbox',
+			   '#default_value' => in_array($field, $current),
+			   '#theme' => 'i18nsync_workflow_checkbox',
+			 );
+			$title = '';  
+		  }     
+		}
      }

      break;

Hope it helps.

mixey’s picture

Status: Needs review » Fixed

thanks, for the patch!

Anonymous’s picture

Status: Fixed » Closed (fixed)
Soren Jones’s picture

StatusFileSize
new1.61 KB

The patch in #2, just in case anyone wants it.

milleusi’s picture

Status: Closed (fixed) » Postponed (maintainer needs more info)

Thx for the patch, but now I have this warning:

user warning: Unknown table 'node_data_field_imagine' in field list query: SELECT node.nid, node.changed AS node_changed_changed, node_data_field_imagine.field_imagine_fid AS node_data_field_imagine_field_imagine_fid FROM drupal6node node LEFT JOIN drupal6i18n_node i18n ON node.nid = i18n.nid WHERE (i18n.language ='en') AND ( (node.status = '1') AND (node.type IN ('poza')) ) ORDER BY node_changed_changed DESC LIMIT 0, 3 in /home/content/s/p/i/spinalcord/html/includes/database.mysql.inc on line 172.

ps:I don't use/have drupal6

jose reyero’s picture

Status: Postponed (maintainer needs more info) » Fixed

Thanks

@milleusi, that's an error related with a different table of a different module, I don't know what it has to do with i18n.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.