开发者

Display a node references' field as a table and not as a list in Drupal

I hav开发者_JS百科e a content types that has a field which holds a list of references to other nodes. By default I can display this as a list which holds titles or have the teasers.

Is it possible to present these as a table instead? Is there a module for that or a trick in Views I could use?


There is indeed a module, Custom Formatters. It's pretty easy to use too. Here is an excerpt from its project page:

... allows users to easily create custom CCK/Field Formatters without the need to write a custom module. Custom Formatters can then be exported as CTools Exportables/Features or Drupal API Formatters.


Because what you need to theme is the display of the field itself, I think your best option is to create a custom module that implements a new formatter for nodereference. Then for your field, you can just select that formatter under display options (or whatever it is called).

I've never created a formatter before, but a bit of Googling revealed this article: http://manueg.okkernoot.net/blog/200907/how-create-cck-formatter

You could also very easily look at the nodereference module itself and see how it implements its current formatters (full node, teaser, etc.).

Hope that helps!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜