3

In my Drupal custom parent theme, I have included a file called panels-pane.tpl.php. This is the main panel pane template. By including this tpl file in my theme, I can override the one in the Panels module folder, which allows me to control its mark-up.

It all works fine. However, when I enable a sub theme that is based on the parent theme, this particular file is ignored. All the other files are inherited.

How can I get this file to be inherited as well?

Would it be possible to force this to be always loaded regardless of the theme?

Please note: I am talking about overriding the panels-pane.tpl.php that comes from the original Panels module. I am not talking about creating a custom Panels layout.

Steps I have tried:

  1. Copying the panels-pane.tpl.php into the sub themes template directory.
  2. Clearing the caches
  3. Uninstalling and then re-enable the parent and sub themes

UPDATED Panels has a file called panels.module. In it has a function called panels_theme(), which contains the following:

  $theme['panels_pane'] = array(
    'variables' => array('output' => array(), 'pane' => array(), 'display' => array()),
    'path' => drupal_get_path('module', 'panels') . '/templates',
    'template' => 'panels-pane',
  );

Can I use this to control panels-pane.tpl.php from inside a module by using theme_registry_alter?

I have tried the following code, but it doesn't work:

function legendary_theme_registry_alter(&$theme_registry) {
 $theme['panels_pane'] = array(
    'variables' => array('output' => array(), 'pane' => array(), 'display' => array()),
    'path' => drupal_get_path('theme', 'legendary') . '/templates',
    'template' => 'panels-pane',
  );
}
2

Here's the weird news, just having a panels-pane.tpl.php in a parent theme should work. It's working for me in a highly used parent theme. So I'm guessing any theme suggestions or other steps aren't going to cut it...

I would check for typos, in this case I would look at the file name (sounds like that's fine), then I would check the sub-theme info file to make sure that's set correctly (although it sounds like that may also be right)

base theme = base_theme_name

Then I would check file permissions on tpl/theme folder. 664 tends to work for me, and apache needs access to it and the folder it's in.

If that seems fine my two steps before I panic with drupal are:

drush rr

restart apache

Hope that helps.

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.