doujianjian2060 2010-11-14 08:39
浏览 32
已采纳

如何为视图2(Drupal 6)定义自定义'notafield'处理程序

I can only find docs for predefined handlers. I guess I would have to override one of the handler classes, but which methods do I actually have to override? I read somewhere that new handler for Views 2 need to be registered with Views. Where and how?

I want to define a field which is not a DB field, but a field calculated from other fields (a countdown to a future date/time).

Edit: I am talking about a custom module which already has two Views 2 fields (two time stamps). Now I want to define two more fields which are not really DB fields, but calculated from the real fields. So we are talking about hook_views_data() here. I don't want to define a concrete field for a concrete view, but the definition of a field which can be used by the user of the module for arbitrary view.

The question is, how are such fields defined? If I declare the field as notafield and set a nonstandard handler function I get an error in the views config GUI Broken/missing handler. I can guess from the views code, that I probably need to override one of the predefined handler classes (as opposed to global functions as with views 1). But which of the methods do I need to override and where do I put the new class and how does views know where to find the class? I can't find any documentation for custom field handler or query handlers.

Edit:
I documented the whole thing here.

  • 写回答

2条回答 默认 最新

  • dongmin1166 2010-11-21 10:02
    关注

    I figured it out (actually the nice folks at the dev list did): The documentation is in the advanced help. Just install views and the advanced help module.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 在获取boss直聘的聊天的时候只能获取到前40条聊天数据
  • ¥20 关于URL获取的参数,无法执行二选一查询
  • ¥15 液位控制,当液位超过高限时常开触点59闭合,直到液位低于低限时,断开
  • ¥15 marlin编译错误,如何解决?
  • ¥15 有偿四位数,节约算法和扫描算法
  • ¥15 VUE项目怎么运行,系统打不开
  • ¥50 pointpillars等目标检测算法怎么融合注意力机制
  • ¥20 Vs code Mac系统 PHP Debug调试环境配置
  • ¥60 大一项目课,微信小程序
  • ¥15 求视频摘要youtube和ovp数据集