Hi ,

I have an entity named offer
I register a theme for it with theme_hook.
How i tell drupal to load the theme from theme folder if exit and if is not from my module theme folder.
Right now is loading only from my module theme folder.

Thanks.

Comments

Jaypan’s picture

It already does this by default.

CaDyMaN’s picture

For me it dose not.
I thought so myself that already does this by default.

Jaypan’s picture

Then there are three possibilities:

1) You need to clear your Drupal cache
2) You've overridden the functionality somehow. Maybe you implemented hook_theme_registry_alter() somewhere.
3) You haven't properly overridden the function/template in your theme. Check for spelling errors.

CaDyMaN’s picture

Around 11 month ago I had this problem.
In fact i have the below code :

/**
 * Implements hook_theme().
 */
function cc_offers_theme() {
  return array(
    'cc_coupons'                            => array(
      'render element' => 'elements',
      'template'       => 'template/coupons',
    ),
  );
}

My expectation was that Drupal will search the template by name or path in the main theme folder but it did not.
In fact it search the template by key name.
In order to load the template from my theme folder I should create the file like cc_coupons.tpl.php the key name not the template value.

So nice :)