How do I write an additional field formatter for an existing field I would like to write a new field formatter for an existing field type. I don't want to replace any existing formatters but offer a new option. 

Or am I better off using a theme_preprocess_field() to do minor alterations? But this seems to be harder to maintain and I'd like to keep my content editors options open (and in the GUI). 

Can someone point me to an example of the proper way to do this?
Personally I'd say a formatter is the better solution.

There are only two hooks you need to implement:


hook_field_formatter_info()
hook_field_formatter_view()


For example:

function MYMODULE_field_formatter_info() {
  return array(
    'my_formatter' =&gt; array(
      'label' =&gt; t('My formatter'),
      // The important bit...
      'field types' =&gt; array('field_type'),
    ),
  );
}

function MYMODULE_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $settings = $display['settings'];
  $element = array();

  if ($display['type'] == 'my_formatter') {
    foreach ($items as $delta =&gt; $item) {
      $element[$delta] = array('#markup' =&gt; $item['value']);
    }
  }

  return $element;
}


For a more in-depth look, download the Examples module and look at field_example - there's plenty of code and documentation there to get you on your way.