Theming custom field directly in custom module folder? we're trying to build a template for the custom field we developed. We don't want to put the template into our theme folder since the template should work between different themes. As far as we know we have the option of putting a custom field.tpl.php somewhere or override theme_field() in our module. What we've been trying with naming these files/functions kind of didn't work out and now we need your help. :-)

What's best practice with building templates / templating for custom fields, where to put it and how to name it?

Thanks! :)
When you define your module's theme info in theme_hook(), you can use drupal_get_path() to find the path to your module, and the path array key in your theme implementation array to point to the directory your tpl is in.

A working example would be:

function field_collection_theme($existing, $type, $theme, $path) {

  $path = drupal_get_path('module', 'field_collection');

  return array(
    'field_collection_op_links' =&gt; array(
      'path' =&gt; $path . '/includes/theme',
      'template' =&gt; 'field-collection-op-links',
      'render element' =&gt; 'op_links',
    ),
  );
}


Where the field_collection_op_links.tpl.php is in field_collection/includes/theme/, no matter where field collection is installed.