Hi all,

i'm new to drupal, and drupal module development.

I'm just trying to develop a very simple custom field for drupal (just for learning purpose), but i cannot have it listed in the Fields menu.

The module code is here: http://pastebin.com/nqpY91QE
The module is correctly installed and recognized by drupal, but when i try to add a field it doesn't appear as an option.

I tried to follow several tutorial, but with no luck. Could you help me undersand what i'm missing???
Many thanks,
Ivan

Comments

download examples.
enable field_example module and take a look at the code. That got me started.

Thank you, pelach.

I have another question.
My custom field need also a db entry for store the result and/or the currency? Or in that case it is managed by drupal?

hook_field_schema() may be what you're looking for. you'll want that in your .install file to define your database.

Yup, you need to implement the above hook so that Drupal can create the table to store your price field's data.

I personally found that looking at the database tables help a lot when I started out.

The examples module is a good place to start though it doesn't give any information on "gotchas", etc which are helpful for newer developers (I just finished a project creating my own field type).

I wrote a brief overview of the process for just that purpose. Check it out at: http://clikfocus.com/blog/custom-field-type-using-fields-api .