Drupal CCK field type with complex fAPI child fields

Posted by Cliff Smith on Stack Overflow See other posts from Stack Overflow or by Cliff Smith
Published on 2009-12-10T20:21:49Z Indexed on 2010/03/09 2:36 UTC
Read the original article Hit count: 470

Filed under:
|
|
|

This question is basically a follow-up to this one:

http://stackoverflow.com/questions/1640534/drupal-custom-cck-field-with-multiple-child-fields

I need to build a CCK field type that stores several pieces of data, and fAPI form elements to accept the input for each piece of data already exist. These elements are built out into multiple HTML form inputs with fAPI #process functions. The problem is that when I try to use these elements in my CCK field, the input from the widget doesn't line up with the database columns specified in hook_field_settings(). The widget returns something like this:

Array (
  [thumbnail_image] =>
    [imceimage_path] => ...
    [imceimage_alt] => ...
    [imceimage_width]  => ...
    [imceimage_height]  => ...
  [user_address] =>
    [address_number] => ...
    [address_street] => ...
    [address_city] => ...
    [address_state] => ...

Unless there's a way to specify "sub-columns" in hook_field_settings(), it appears to me that I can't use form element types with sub-elements in CCK fields. I've tried using CCK field validation to pull out the "imce_xxx" values from thumbnail_image and likewise with user_address, but that doesn't get me anywhere.

Is it not possible to use form elements with child elements in CCK field definitions?

Thanks,
Cliff Smith

© Stack Overflow or respective owner

Related posts about drupal

Related posts about drupal-6