When you tries to make a views intergration of a custom field type you have the problem that you dont know the name of the table - the tables are made when an instance of the field is created. Many instances can be created and you dont know there name when you write youre module. (field_data_somename)

How do you write the hook_views_data()?

I been looking into some contributed modules(resource_booking, geofield) and i found a solution, i thought:

function geofield_field_views_data($field) {
  $data = field_views_field_default_views_data($field);
  $field_name = $field['field_name'];

  foreach ($data as $table_name => $table_data) {
    if (isset($table_data[$field_name])) {
      $group_name = $table_data[$field_name]['group'];
      $title = $table_data[$field_name]['title'] . " ($field_name) - proximity";
      $data[$table_name]['field_geofield_distance'] = array(
... snipp ...   

(from the geofield.views.inc)
Greate - I get the the values from field_views_field_default_views_data function. Except that hook_view_data doesn´t have a $field argument. In fact - the API says that it doesnt have any arguments - and if I write a hook_views_data($field) i dont get any $field - i get "Warning: Missing argument 1 for hook_views_data()"

I dont get it - is there a way to make the hook_views_data having a $field argument? I looked at these module and I cant find how they do.

Perhaps theres a better way to do it - but this solution seems a good one - if it worked.