开发者

How are custom 'notafield' handlers defined for Views 2 (Drupal 6)

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 Brok开发者_开发知识库en/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.


The module "views_customfield" can be used to create custom field for views.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜