This issue was origially posted in Views issues: http://drupal.org/node/280174 but as it relates to Internationalization, I'm reposting it here with additional detail.

I am getting an error in both FF and IE when I enable the default glossary view in Views:

warning: Invalid argument supplied for foreach() in /home/.urena/ccd/drupal/sites/all/modules/i18n/i18ntaxonomy.module on line 578.

And line 578 is: foreach($view->field as $index => $data) {

Here is the export of the view:

$view = new view;
$view->name = 'glossary';
$view->description = 'A list of all content, by letter.';
$view->tag = 'default';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
'title' => array(
'label' => 'Title',
'link_to_node' => 1,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'relationship' => 'none',
),
'name' => array(
'label' => 'Author',
'link_to_user' => 1,
'exclude' => 0,
'id' => 'name',
'table' => 'users',
'field' => 'name',
'relationship' => 'none',
),
'changed' => array(
'label' => 'Last update',
'date_format' => 'large',
'custom_date_format' => '',
'exclude' => 0,
'id' => 'changed',
'table' => 'node',
'field' => 'changed',
'relationship' => 'none',
),
));
$handler->override_option('arguments', array(
'title' => array(
'default_action' => 'default',
'style_plugin' => 'default_summary',
'style_options' => array(),
'wildcard' => 'all',
'wildcard_substitution' => 'All',
'title' => '',
'default_argument_type' => 'fixed',
'default_argument' => '',
'validate_type' => 'none',
'validate_fail' => 'not found',
'glossary' => 1,
'limit' => '1',
'case' => 'upper',
'path_case' => 'lower',
'transform_dash' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'relationship' => 'none',
'default_argument_user' => 0,
'default_argument_fixed' => 'a',
'default_argument_php' => '',
'validate_argument_vocabulary' => array(),
'validate_argument_type' => 'tid',
'validate_argument_php' => '',
),
));
$handler->override_option('access', array(
'type' => 'none',
'role' => array(),
'perm' => '',
));
$handler->override_option('use_ajax', '1');
$handler->override_option('items_per_page', 36);
$handler->override_option('use_pager', '1');
$handler->override_option('style_plugin', 'table');
$handler->override_option('style_options', array(
'grouping' => '',
'override' => 1,
'sticky' => 0,
'order' => 'asc',
'columns' => array(
'title' => 'title',
'name' => 'name',
'changed' => 'changed',
),
'info' => array(
'title' => array(
'sortable' => 1,
'separator' => '',
),
'name' => array(
'sortable' => 1,
'separator' => '',
),
'changed' => array(
'sortable' => 1,
'separator' => '',
),
),
'default' => 'title',
));
$handler = $view->new_display('page', 'Page', 'page');
$handler->override_option('path', 'glossary');
$handler->override_option('menu', array(
'type' => 'normal',
'title' => 'Glossary',
'weight' => '0',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'weight' => 0,
));
$handler = $view->new_display('attachment', 'Attachment', 'attachment');
$handler->override_option('arguments', array(
'title' => array(
'default_action' => 'summary asc',
'style_plugin' => 'unformatted_summary',
'style_options' => array(
'count' => 1,
'override' => 0,
'items_per_page' => '25',
'inline' => 1,
'separator' => ' | ',
),
'wildcard' => 'all',
'wildcard_substitution' => 'All',
'title' => '',
'default_argument_type' => 'fixed',
'default_argument' => '',
'validate_type' => 'none',
'validate_fail' => 'not found',
'glossary' => 1,
'limit' => '1',
'case' => 'upper',
'path_case' => 'lower',
'transform_dash' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'relationship' => 'none',
'default_argument_user' => 0,
'default_argument_fixed' => 'a',
'validate_argument_vocabulary' => array(),
'validate_argument_php' => '',
),
));
$handler->override_option('inherit_arguments', 0);
$handler->override_option('displays', array(
'default' => 'default',
'page' => 'page',
));

Have I done something wrong or is there a conflict between Views and i18n? Any suggestions on how to fix this?

Comments

meruthecat’s picture

Here's a update also posted on the following thread: http://drupal.org/node/280174.

I have a second site running off the same Drupal install and when I enable the default Glossary view, it works fine there. So I disabled i18n and the related components on my problematic multilingual site and the Glossary view worked. After enabling the i18n components one-by-one as was able to isolate Multilingual Taxonomy as the one that is creating the error.

Since Multilingual Taxonomy was creating my Glossary view error, I tried this test on another Views error I was getting in IE:

warning: Invalid argument supplied for foreach() in /home/.urena/ccd/drupal/sites/all/modules/views/theme/views-view-fields.tpl.php on line 22.

And once again it was this component causing the conflict. I need to keep Multilingual Taxonomy enabled, so does anyone have ideas on what could be causing this or what to do to fix it?

andrey.filippov’s picture

I've got the same problem
>> And line 578 is: foreach($view->field as $index => $data) {
A quick fix (seems everything is still working, just an error message to get rid of) will be to replace that line with

if ($view->field) foreach($view->field as $index => $data) {

The value of $view->field is NULL when the error takes place

jose reyero’s picture

Assigned: Unassigned » jose reyero
Category: support » task

Now views module is close to a stable release, I'll be updating i18n integration with views.

However, to prevent these module incompatibilities, the views integration will be moved to a new module (i18nviews) available soon.

jose reyero’s picture

Added translation for views titles, header, footer...

meruthecat’s picture

Jose,

Thanks for the update. I upgraded to Drupal 6.3 with the hope that the Views-i18n integration would work better. I'm getting additional conflicts to the one mentioned above. Filter by node language is not working on a custom view. Also, I'm getting the following error on the view in Firefox:

warning: Invalid argument supplied for foreach() in /home/.urena/ccd/drupal/sites/all/modules/views/theme/views-view-fields.tpl.php on line 22.

Here is an export of the view in the event someone can help me fix the problem now. I'm looking forward to the i18nviews release.

Thanks.

$view = new view;
$view->name = 'Links';
$view->description = 'links';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
'tid' => array(
'label' => '',
'type' => 'separator',
'separator' => ', ',
'empty' => '',
'link_to_taxonomy' => 0,
'limit' => 0,
'vids' => array(
'5' => 0,
'3' => 0,
'1' => 0,
),
'exclude' => 1,
'id' => 'tid',
'table' => 'term_node',
'field' => 'tid',
'relationship' => 'none',
),
'field_links_url' => array(
'label' => '',
'link_to_node' => 0,
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_links_url',
'table' => 'node_data_field_links',
'field' => 'field_links_url',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
));
$handler->override_option('sorts', array(
'name' => array(
'id' => 'name',
'table' => 'term_data',
'field' => 'name',
),
'field_links_title' => array(
'order' => 'ASC',
'id' => 'field_links_title',
'table' => 'node_data_field_links',
'field' => 'field_links_title',
'relationship' => 'none',
),
));
$handler->override_option('filters', array(
'status' => array(
'operator' => '=',
'value' => 1,
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'status',
'table' => 'node',
'field' => 'status',
'relationship' => 'none',
),
'type' => array(
'operator' => 'in',
'value' => array(
'link' => 'link',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
'role' => array(),
'perm' => '',
));
$handler->override_option('title', 'Links');
$handler->override_option('style_options', array(
'grouping' => 'tid',
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('filters', array(
'status' => array(
'operator' => '=',
'value' => 1,
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'status',
'table' => 'node',
'field' => 'status',
'relationship' => 'none',
),
'type' => array(
'operator' => 'in',
'value' => array(
'link' => 'link',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
'language' => array(
'operator' => 'in',
'value' => array(
'en' => 'en',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'language',
'table' => 'node',
'field' => 'language',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
));
$handler->override_option('title', 'Links');
$handler->override_option('path', 'links');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'weight' => 0,
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'weight' => 0,
));
$handler = $view->new_display('page', 'Page', 'page_2');
$handler->override_option('filters', array(
'status' => array(
'operator' => '=',
'value' => 1,
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'status',
'table' => 'node',
'field' => 'status',
'relationship' => 'none',
),
'type' => array(
'operator' => 'in',
'value' => array(
'link' => 'link',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
'language_1' => array(
'operator' => 'in',
'value' => array(
'fr' => 'fr',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'language_1',
'table' => 'node',
'field' => 'language',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
));
$handler->override_option('title', 'Liens');
$handler->override_option('path', 'liens');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'weight' => 0,
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'weight' => 0,
));
$handler = $view->new_display('page', 'Page', 'page_3');
$handler->override_option('filters', array(
'status' => array(
'operator' => '=',
'value' => 1,
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'status',
'table' => 'node',
'field' => 'status',
'relationship' => 'none',
),
'type' => array(
'operator' => 'in',
'value' => array(
'link' => 'link',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
'language' => array(
'operator' => 'in',
'value' => array(
'es' => 'es',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'language',
'table' => 'node',
'field' => 'language',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
));
$handler->override_option('title', 'Enlaces');
$handler->override_option('path', 'enlaces');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'weight' => 0,
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'weight' => 0,
));

jose reyero’s picture

Status: Active » Fixed

No conflict anymore, but just a few things can be translated so far, see http://drupal.org/node/313262

Anonymous’s picture

Status: Fixed » Closed (fixed)

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