Undefined index: tid in taxonomy_field_formatter_prepare_view() error in drupal 7

StackOverflow https://stackoverflow.com/questions/21868747

  •  13-10-2022
  •  | 
  •  

Pergunta

Is it normal that the hook_field_formatter_prepare_view() implementation in core taxonomy module get non taxonomy $items (e.g. image or location items)

I was able to remove the error by replacing in taxonomy.module:

  if ($item['tid'] != 'autocreate' ) {
    $tids[$item['tid']] = $item['tid'];
  }

with:

  if(isset($item['tid'])){
   if ($item['tid'] != 'autocreate' ) {
     $tids[$item['tid']] = $item['tid'];
   }
  }

But i guess patching the drupal core is not a real solution. Any idea why i get items with undefined tid?

Foi útil?

Solução

The problem was that the content had been migrated from drupal 6. The specific content type had some "views attach" fields. Since this module is deprecated in d7 the fields remained orphaned and they were causing the prob. I was able to find what fields did not have a valid name in the field list page. Then used the following php command to delete the problematic fields

field_attach_delete_bundle('node', 'problematic_field_name');
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top