Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 302535

Do not copy over the owner and engine of a theme if the child theme uses a different engine than the base theme

$
0
0

When you are using a different theme engine than php-template in your sub theme that extends a base theme that uses php-template, the system module copies the engine and owner of the base theme over in the child theme. This results in the child theme not using the engine defined in the .info file.

For example, I created a subtheme called mothertwig which extends mothership

name = Mothership
description = The Motheship is a basetheme for cleaning up crufty markup
screenshot = screenshot.png
engine = phptemplate
core = 7.x
php = 5.2
name = mothertwig
description = TWIGalized version of the mother
screenshot = screenshot.png
engine = twig
core = 7.x
php = 5.2
base theme = mothership

The result was that if you did a var_dump of list_themes()—both themes where assigned to php-template.

Possible work around for sub-themes using Twig for D7

Add the following to the template.php (7.x) file:

/**
 * Implements hook_system_info_alter().
 */
function mothertwig_system_info_alter(&$info, $file, $type) {
  if ($type == 'theme'&& module_exists('tfd7') && ($info['name'] === 'mothership' || $info['base theme'] === 'mothership')) {
    $info['engine'] = 'twig';
  }
}

Viewing all articles
Browse latest Browse all 302535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>