How to override a module theme function in a custom module but still allow themes to override the template file? I'm writing a fairly simple module which allows the removal of colons from field output on a per field basis and I need to override the core field module's theme_field function in my module.

I can modify the theme registry with hook_theme_registry_alter() and change the field function to point to my custom function. Unfortunately once I do that I'm no longer able to override field.tpl.php in a theme.

The cascade I'd like to achieve is in order of template preference (most important first):


Active theme's field.tpl.php
My custom module's field.tpl.php (or custom_field theme function)
Field module's theme_field function


Is this possible?

This answer comes close but requires a differently named template which I don't want. I'd like to keep things clean for the themer so if they override field.tpl.php in their theme the output is as expected, rather than having to copy a different tpl file from my custom module.
Think what you describe could work without falling back to the field module's function:


Add &lt;?php function MODULENAME_preprocess_field($variables) ?&gt; and set a $colon variable with either ':' or ''
Copy the theme_field function in your module and rename it &lt;?php MODULENAME_field(&amp;$variables) ?&gt;
Replace the code that renders the label with: &lt;?php $output .= '&lt;div class="field-label"' . $variables['title_attributes'] . '&gt;' . $variables['label'] . $variables['colon'] . '&amp;nbsp;&lt;/div&gt;';?&gt;


Might also just document for themers that in the template file they should use $colon for the module to work.