Why does template.php override not work? I'm trying to get links from the PDFPreview module to open in a new tab. As described in this issue, overriding the formatter function in template.php does not work.  One can modify the function in the actual .module file, but this is obviously not good practice.  Why does it not work?

Code from the module:

/**
 * Theming functions for our formatters
 *
 * @todo Clearify the image cache thing...
 * @todo Let user choose what preview image to show on non-PDF files
 */
function theme_pdfpreview_formatter($variables) {
  $img_tag = '';
  $item = $variables['item'];

  $image = array(
    'title' =&gt; $item['description'],
    'uri' =&gt; $item['preview'],
  'alt' =&gt; $item['description'],
  );

  $element =array();
  $element['item'] = $image;
  $element['image_style'] = $variables['settings']['image_style'];
  switch ($variables['settings']['image_link']) {
    case 'file':
      $element['path'] = array(
        'path' =&gt; file_create_url($item['uri']),
        'options' =&gt; array(),
      );
      break;
      case 'content':
      $element['path'] = array(
        'path' =&gt; $variables['entity_type'] . '/' . $variables['entity']-&gt;nid,
        'options' =&gt; array(),
      );
      break;
  }
  $img_tag = theme('image_formatter', $element);
  $wrapper_tag = $variables['settings']['tag'];
  $description = $variables['settings']['show_description'] ? '&lt;' . $wrapper_tag . ' class="pdfpreview-description"&gt;' . $item['description'] . '&lt;/' . $wrapper_tag . '&gt;' : '' ;
  return sprintf(
          '&lt;div class="pdfpreview pdfpreview-%s" id="pdfpreview-%s"&gt;'
          . ' &lt;%s class="pdfpreview-image-wrapper"&gt;%s&lt;/%s&gt;'
          . ' %s'
          . '&lt;/div&gt;',
          $variables['instance']['field_name'],
          $item['fid'],
          $wrapper_tag, $img_tag, $wrapper_tag,
          $description
  );
}


Code from template.php:

/**
 * Theming functions for our formatters
 *
 * @todo Clearify the image cache thing...
 * @todo Let user choose what preview image to show on non-PDF files
 */
function my_theme_pdfpreview_formatter($variables) {
  $img_tag = '';
  $item = $variables['item'];

  $image = array(
    'title' =&gt; $item['description'],
    'uri' =&gt; $item['preview'],
  'alt' =&gt; $item['description'],
  );

  $element =array();
  $element['item'] = $image;
  $element['image_style'] = $variables['settings']['image_style'];
  switch ($variables['settings']['image_link']) {
    case 'file':
      $element['path'] = array(
        'path' =&gt; file_create_url($item['uri']),
        'options' =&gt; array('attributes' =&gt; array('target' =&gt; '_blank')),
      );
      break;
      case 'content':
      $element['path'] = array(
        'path' =&gt; $variables['entity_type'] . '/' . $variables['entity']-&gt;nid,
        'options' =&gt; array(),
      );
      break;
  }
  $img_tag = theme('image_formatter', $element);
  $wrapper_tag = $variables['settings']['tag'];
  $description = $variables['settings']['show_description'] ? '&lt;' . $wrapper_tag . ' class="pdfpreview-description"&gt;' . $item['description'] . '&lt;/' . $wrapper_tag . '&gt;' : '' ;
  return sprintf(
          '&lt;div class="pdfpreview pdfpreview-%s" id="pdfpreview-%s"&gt;'
          . ' &lt;%s class="pdfpreview-image-wrapper"&gt;%s&lt;/%s&gt;'
          . ' %s'
          . '&lt;/div&gt;',
          $variables['instance']['field_name'],
          $item['fid'],
          $wrapper_tag, $img_tag, $wrapper_tag,
          $description
  );
}
Use my_theme_pdfpreview, because even though there's a specific function assigned to it in hook_theme(), you should use the key to override.

I admit I got confused as well at first :)