[support] Help with hook_field_info() and friends

Patrick Avella me at patrickavella.com
Mon Nov 28 16:32:41 UTC 2011


Hello, I'm new to the fields/CCK api, and having a bit of trouble getting
Drupal 7 to see my field.

I found the field_example module in the examples.module, and found the
corresponding presentation on Acquia TV (though the text was too low res to
read).

I'm able to copy the RGB Color field example, enable it, and Drupal 7 sees
and uses it without a hitch. I tried replacing instances field_example with
mymodule but then Drupal stops seeing the field even after a drush dis
mymodule && drush en mymodule.

In the presentation the speaker said that all fields had a few minimum
hooks, but I couldn't quite make it out on the screen. I tried to make a
minimal field using just hook_field_info, hook_field_is_empty,
hook_field_schema, and hook_field_validate, but I seem to still be doing
something wrong.

I can post my code to the mailing list if desired, but I think what would
really help me is if there is a minimal example of using hook_field_info
and friends somewhere on the internet I can read through? I'm really not
sure  where I'm going wrong in my code (no php errors or watchdog warnings,
field just doesn't become available.) A smaller more digestible example
would probably help me greatly. If not, can anyone point me to what hooks
are the bare minimum that need to be implemented?

As an alternative to field_info I started using hook_node_presave() to
mish-mash values, but I get an impression that's not the best way to make a
custom field.


Thanks a bunch,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20111128/4c3b1e1a/attachment.html 


More information about the support mailing list