After Upgrading to the GT 2.9 Theme, Formatting Breaks on Custom Content Types

Category
Drupal Version

Issue

After updating to the 2.9 version of the GT Theme, the formatting is broken for custom content types (such as Super Blocks and Slideshow Carousels), usually those created via the Features module. Often the types show CSS classes as text instead of as visual styling.

Example of broken Super Blocks

super blocks showing css classes as text instead of styling

Solution

Find the theme_registry_alter function in your feature's .module file and make the following replacement

Replace:

$theme_registry['template-file']['path'] = drupal_get_path('module', 'gt_ct_carousel_slider') . "/templates/";

With:

// Defined path to the current module.
  $module_path = drupal_get_path('module', 'gt_ct_carousel_slider');
  // Find all .tpl.php files in this module's folder recursively.
  $template_file_objects = drupal_find_theme_templates($theme_registry, '.tpl.php', $module_path);
  // Iterate through all found template file objects.
  foreach ($template_file_objects as $key => $template_file_object) {
    // If the template has not already been overridden by a theme.
    if (!isset($theme_registry[$key]['theme path']) || !preg_match('#/themes/#', $theme_registry[$key]['theme path'])) {
      // Alter the theme path and template elements.
      $theme_registry[$key]['theme path'] = $module_path;
      $theme_registry[$key] = array_merge($theme_registry[$key], $template_file_object);
      $theme_registry[$key]['type'] = 'module';
    }
  }

For more information, see Using template (.tpl.php) files in your own module on the Drupal.org website.