So I've got this problem where file_entity is ignoring the configured video formatter despite triple-checking the GUI configuration. Instead it's being rendered by theme_file_entity_file_video(), which shouldn't be happening.

But it is. So I'm digging back into core to see where the theme function responsible was established. I'm in drupal_render but I'm already seeing the theme function set improperly...

So my question: Where does drupal determine which theme file/function to use for an entity field?

Clarification: my question is, "How/where does the theme registry get built for an entity?" I want to watch it get built with a debugger.


Everything can be overridden by one hook in any module so bear that in mind.

The theme registry is where everything is stored in terms of theming for pages/entities. It all depends on the order here in determining the theme it will use.

You can use the devel module and dpm out the theme registry:


It usually is built in this order:

  1. module where entity is created
  2. module where function was called to get the entity
  3. your theme directory

but at any point that could have been overridden

  • I appreciate this here and I will +1 it, and this did solve my problem, because I consulted the theme registry and found that the theme hooks were not getting applied to my entities after digging. But my question is more "where/how does the theme registry get built for an entity?" – Jeremy John Sep 18 '15 at 15:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.