Theme a multiple CCK field with a table

Sometimes CCK contrib modules cannot do exactly what you want. It’s time to build your custom CCK field!

Official documentation on CCK fields creation for Drupal 6 is incomplete and some passages are obscure. If there is a good howto you have to read before do any CCK customization, this is Creating Custom CCK Fields. This howto supposes you’ve read and understand it before continue. If you want to create a custom field, you can read the complete Creating a Compound field. A custom multiple compound field (with more than one field for element, e.g. an image and its description).

Creating Custom CCK Fields

Creating a Compound field

Well, you have followed the howto, you have your own compound field but now you have a problem. You want to display compound field data as cells in a table, and each field as row.

On following example, we have a name list made with a multiple compound field with “firstname” and “lastname” columns.

KarenS tell you that you’ve to use CONTENT_HANDLE_MODULE instead of CONTENT_HANDLE_CORE on hook_formatter_info() .

Note: to format a table you have to change only “multiple values” on my_funny_module_field_formatter_info(): you can leave my_funny_module_widget_info() as is.

See also:

https://web.archive.org/web/20090806000000*/http://www.lullabot.com/articles/creating-custom-cck-fields

https://web.archive.org/web/20090806000000*/http://www.poplarware.com/cckfieldmodule.html

https://web.archive.org/web/20090806000000*/http://www.lullabot.com/articles/creating-custom-cck-fields

https://web.archive.org/web/20090806000000*/http://www.poplarware.com/cckfieldmodule.html

https://web.archive.org/web/20090806000000*/http://api.drupal.org/api/function/theme_table/6

Proxied content from gemini://chirale.org/2009-08-06_365.gmi (external content)

Gemini request details:

Original URL
gemini://chirale.org/2009-08-06_365.gmi
Status code
Success
Meta
text/gemini; charset=utf-8
Proxied by
kineto

Be advised that no attempt was made to verify the remote SSL certificate.