【问题标题】:Undefined index: tid in taxonomy_field_formatter_prepare_view() error in drupal 7未定义的索引:drupal 7 中 taxonomy_field_formatter_prepare_view() 中的 tid 错误
【发布时间】:2014-02-19 00:50:25
【问题描述】:

核心分类模块中的hook_field_formatter_prepare_view() 实现获得非分类$items(例如图像或位置项)是否正常

我能够通过在 taxonomy.module 中替换来消除错误:

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

与:

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

但我想修补 drupal 核心并不是一个真正的解决方案。知道为什么我会得到未定义 tid 的项目吗?

【问题讨论】:

标签: drupal drupal-taxonomy


【解决方案1】:

问题在于内容已从 drupal 6 迁移。特定的内容类型有一些“视图附加”字段。由于此模块在 d7 中已弃用,因此字段仍然是孤立的,并且它们导致了问题。我能够在字段列表页面中找到哪些字段没有有效名称。然后用下面的php命令删除有问题的字段

field_attach_delete_bundle('node', 'problematic_field_name');

【讨论】:

    猜你喜欢
    • 2014-02-17
    • 2015-02-19
    • 2014-12-20
    • 1970-01-01
    • 2013-11-23
    • 1970-01-01
    • 1970-01-01
    • 2011-12-12
    • 2015-10-26
    相关资源
    最近更新 更多