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?

有帮助吗?

解决方案

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');
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top