How to format a custom field excuseme if this question can (seem to) be stupid, but I don't figure how to solve...

Shortly, my custom module:


exposes a node type
exposes an entity type
attach to that node a field containing a set of these entities (by using entity_reference)


I would like to customise how those entities are visualised in the node view page: I would like to show more info instead of just the entity label.

I read something about hook_field_formatter_info(), that seems to be the best solution, but my debugger suggests that is not invoked (neither after a cache clear)... on the other I can't find any info about how to explain this to hook_theme().

The ideal behaviour should be to tell to Drupal:


use a specific template file to render all fields belonging to a given field instance
allow a theme to override that representation in a new template file


Do you have a snippet of code or a web resource explaining how to instruct my module to do this?

Thank you
hook_field_formatter_info() hook lets Drupal know about the new display denfinition and field settings, you will see your display type under Manage display settings of your content type. However the actual format of the field is returned with help of hook_field_formatter_view.

Example Code