开发者

How does a CCK formatter know which field and node it's referring to?

开发者 https://www.devze.com 2023-01-11 05:10 出处:网络
I\'m new to CCK development and I\'m having some problems creating a new field for my system. In particular, I\'m writing a widget that attaches a file to a field.Once that happens, how can a formatt

I'm new to CCK development and I'm having some problems creating a new field for my system.

In particular, I'm writing a widget that attaches a file to a field. Once that happens, how can a formatter function figure out which field and node it's referring to in order to retrieve the right file associated with that field? Is there any way to store the file information directly in the $element array?

I'd appreciate examples that show how this could be done. I'd also appreciate good references on how to build widgets and formatters...

Thank开发者_运维技巧s so much!


A long time ago I wrote about CCK field formatters on my blog.

Field formatters are basically theme functions, CCK call them when it has gotten the content and want it rendered. The nature of the content can vary a lot, it depends what field/widget that is used.


I'm not exactly sure what your end goal is, but there may already be a module that does what you are trying to do. If you could explain it a little more I can let you know if I know of a module that would be of help to you.

0

精彩评论

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

关注公众号