Hi folks,

I have the following error that cant found in other issues.
Notice: Undefined index: taxonomy_term in i18n_taxonomy_field_formatter_view() (line 218 of /home/..../sites/all/modules/contrib/i18n/i18n_taxonomy/i18n_taxonomy.module).

this happens in node type with term reference fields, in a multilang site (catalan, spanish and galego) when clicking preview button.

I do some debbuing and I solved it as following. In file sites/all/modules/contrib/i18n/i18n_taxonomy/i18n_taxonomy.module arround line 219:

case 'i18n_taxonomy_term_reference_link':
      foreach ($items as $delta => $item) {
        if ($item['tid'] == 'autocreate') {
          $element[$delta] = array(
            '#markup' => check_plain($item['name']),
          );
        }
        else {
          $term = $item['taxonomy_term'];
  .....

add:

case 'i18n_taxonomy_term_reference_link':
      foreach ($items as $delta => $item) {
        if ($item['tid'] == 'autocreate') {
          $element[$delta] = array(
            '#markup' => check_plain($item['name']),
          );
        }
        else {
          $term = $item['taxonomy_term'];
          if($term == NULL) {
            if($item['tid'] != NULL) {
              $term = taxonomy_term_load($item['tid']);
            }
          } 

Its some similar to this issue: https://drupal.org/node/934726 solved with the patch https://drupal.org/files/934726-89.patch

now for me is working. I hope this will be useful for someone.

cheers.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

paolomainardi’s picture

I confirm this bug.

paolomainardi’s picture

Status: Active » Needs review
FileSize
642 bytes

Patch attached.

Status: Needs review » Needs work

The last submitted patch, i18n_taxonomy-undefined_index-2092883-2.patch, failed testing.

paolomainardi’s picture

Up

geek-merlin’s picture

Title: Undefined index: taxonomy_term in i18n_taxonomy_field_formatter_view() in node preview » Term field not displayed & Notice: Undefined index: taxonomy_term in i18n_taxonomy_field_formatter_view() in node preview
Version: 7.x-1.8 » 7.x-1.x-dev
Priority: Normal » Major
Status: Needs work » Needs review
FileSize
1.68 KB

Thanks for getting the ball rolling!

This issue is completely parallel to this RTBC sode issue #2128265: Term field not displayed + Notice: Undefined index: taxonomy_term in taxonomy_field_formatter_view() (line 1596 of taxonomy.module).

The patch is on the right track but does not cover all code paths (and does not apply).

Patch flying in copying the approach from the other issue and covering all relevant code paths (only 2 here) using i18n functions.

Added the "not shown" symptom to title & raising prio as a not showing field is surely a "significant repercussion".

Please test so we can get this in.

Nabako’s picture

Patch worked for me. After applying it; no Notice message displayed anymore.

geek-merlin’s picture

Status: Needs review » Reviewed & tested by the community

So rtbc.

geek-merlin’s picture

Another worksforme: Fixed a site that showed a WSOD when viewing a node.

Just for the records, here's the backtrace. (strange that field_view_field did not call field_default_prepare view / taxonomy_field_formatter_prepare_view)

Notice: Undefined index: taxonomy_term in i18n_taxonomy_field_formatter_view() (line 216 of /var/www/virtual/clsysdev/html/live/docroot/sites/all/modules/i18n/i18n_taxonomy/i18n_taxonomy.module). Backtrace:
i18n_taxonomy_field_formatter_view('node', Object, Array, Array, 'und', Array, Array) field.default.inc:210
field_default_view('node', Object, Array, Array, 'und', Array, Array, NULL) field.attach.inc:209
_field_invoke('view', 'node', Object, Array, NULL, Array) field.attach.inc:385
_field_invoke_default('view', 'node', Object, Array, NULL, Array) field.module:888
field_view_field('node', Object, 'field_fiw_topics', Array, 'und') views_handler_field_field.inc:852
views_handler_field_field->set_items(Object, 0) views_handler_field_field.inc:683
views_handler_field_field->post_execute(Array) view.inc:744
view->_post_execute() view.inc:1164
view->execute(NULL) view.inc:1192
view->render() views_plugin_display.inc:2696
views_plugin_display->preview() view.inc:1368
view->preview() views_panes.inc:287
views_content_views_panes_content_type_render('fiw_organisations-panel_pane_1', Array, Array, Array, '') content.inc:281
ctools_content_render('views_panes', 'fiw_organisations-panel_pane_1', Array, Array, Array, Array) panels_renderer_standard.class.php:567
panels_renderer_standard->render_pane_content(Object) panels_renderer_standard.class.php:503
panels_renderer_standard->render_pane(Object) panels_renderer_standard.class.php:482
panels_renderer_standard->render_panes() panels_renderer_standard.class.php:389
panels_renderer_standard->render_layout() panels_renderer_standard.class.php:360
panels_renderer_standard->render() panels.module:764
panels_display->render(NULL) panels.module:1130
panels_render_display(Object) panels_mini.inc:109
panels_mini_panels_mini_content_type_render('fiw_content_per_organisation', Array, Array, Array, '') content.inc:281
ctools_content_render('panels_mini', 'fiw_content_per_organisation', Array, Array, Array, Array) ds.module:905
ds_render_ctools_field(Array) ds.module:455
ds_get_field_value('fiw_dynamic_field', Array, Object, 'node', 'fiw_organisation', 'full', Array) ds.module:536
ds_field_attach_view_alter(Array, Array, NULL, NULL) module.inc:1157
drupal_alter('field_attach_view', Array, Array) field.attach.inc:1244
field_attach_view('node', Object, 'full', 'de') node.module:1415
node_build_content(Object, 'full', 'de') node.module:1336
node_view(Object, 'full', NULL) node.module:2669
node_view_multiple(Array, 'full') node.module:1466
node_show(Object) node.module:2761
node_page_view(Object) 
call_user_func_array('node_page_view', Array) menu.inc:527
menu_execute_active_handler() index.php:21

joseph.olstad’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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