1

I'm having a dickens of a time overriding entity.tpl.php to create custom themes for my entities.

I am using ECK and Inline Entity Form. I've created entity section with bundle masthead. I've linked this to a node.

In a subtheme of the bootstrap theme, I then try to create a custom theme for this entity in a file called entity--section--masthead.tpl.php (note: I've also tried section.tpl.php and section--masthead.tpl.php and all sorts of permutations). Clear Cache. Nothing.

The only documentation is a few years old, and one of the most recent comments says this SHOULD work without the need for various hooks.

1 Answer 1

1

You don't need to add entity string to the template file name. These are theme hook suggestions for entity built with ECK (assuming your entity and bundle names):

  1. section.tpl.php
  2. section--masthead.tpl.php
  3. section--masthead--full.tpl.php
  4. section--[ID].tpl.php

As you can see there is a naming conflict because section is a drupal builtin template. It would be safer to use different name for your entity.

2
  • I can't figure how I should put a file so-named into my module (not theme) folder... because it is not loaded (it is in the template suggestions, but the entity.tpl is always loaded) Commented Nov 30, 2016 at 18:04
  • This is incorrect. The template names should be delimited with -- and not __. I have suggested an edit. Commented Oct 18, 2017 at 17:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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