Custom module - find out the name of the field I have written a custom field module and I would like to know how I can programmatically find out what the name of the field in the database.

E.g. someone installs my module, that installs a new fieldtype and widget. The user adds a new field to a content type and calls the field "test_field". How can the module provide the database name of the field ("test_field") to some function within the module?

Currently I am hard-coding the name of the field which works fine until a user decides to use another name. Then I am not able to do some database operations anymore.
OK. I ended up doing it a little differently:

In my field_widget_form function I added a hidden field. In this function it is possible to access the $field and therefore the name of the field using

$field['field_name'];

So I saved that value to the hidden form. Then when I trigger a function within that form it is able to access that value. So in my different function that relies on the machine_name of the field I actually access the value of the form that is set when the widget form is built.