[development] Reusing elements in a compound CCK field

Bill Fitzgerald bill at funnymonkey.com
Tue Jun 30 04:48:15 UTC 2009


Have you seen http://drupal.org/node/119102 ? -- you might want to skip 
to the second page and only read comments 301-600  --

You could also check out http://drupal.org/project/education_field and 
http://drupal.org/project/employment_field, although the approach used 
in the patch will likely allow more options over time.

Cheers,

Bill

Yuval Hager wrote:
> I am writing an application in which I need a compound cck field - a 
> nodereference and a numerical value. The underlying database table MUST 
> keep both values in the same record (no "delta" based value matching, like 
> CCK multigroup does), so I reverted to writing my own CCK compound field 
> module.
>
> However, I am having a hard time understanding if I can reuse the elements 
> declared by the nodereference and the number module for my case. I am 
> trying, for example, to use '#type' => 'nodereference_autocomplete' in my 
> element #process function, but maybe I do not need to define an element at 
> all? Maybe I should just use it in hook_widget? Also, How can I convince 
> nodereference and number to work on MY definition of #columns? This goes 
> for validation, autocompletion and value (stripping out the "[nid:]"). I am 
> not finding good documentation for this, and the code for other modules who 
> do similar stuff is rather confusing (I looked at a few). Before I revert 
> to voodoo or code duplication - can anybody shed some light on the subject?
> If needed, I can paste my (non working) code here.
>
> There are a few documentation points for this on the net - the best I've 
> found is http://poplarware.com/cckfieldmodule.html by Jennifer Hodgdon. 
> Thank you Jennifer, this is a great guide. However, this guide delegates a 
> lot of functionality to filefield/imagefield, and my case is quite 
> different. CCK documentation on these hooks is rather laconic, or not up to 
> date with the latest version.
>
> This also makes me wonder if one can write a generic compound CCK field 
> module, that will allow the user to reuse existing fields and build a new 
> one using the UI only. But first things first - the specific case should 
> work before the generic one :)
>
> Cheers,
>
> --yhager
>
>   


-- 

Bill Fitzgerald
http://funnymonkey.com
FunnyMonkey -- Click. Connect. Learn.
ph. 503 897 7160



More information about the development mailing list