diff --git a/includes/theme.inc b/includes/theme.inc index 25f89f9..8e0d9e0 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -1328,7 +1328,13 @@ function drupal_find_theme_templates($cache, $extension, $path) { $matches = preg_grep('/^' . $pattern . '/', $patterns); if ($matches) { foreach ($matches as $match) { - $file = substr($match, 0, strpos($match, '.')); + $file = $match; + // Chop off the remaining extensions if there are any. $template already + // has the rightmost extension removed, but there might still be more, + // such as with .tpl.php, which still has .tpl in $template at this point. + if (($pos = strpos($match, '.')) !== FALSE) { + $file = substr($match, 0, $pos); + } // Put the underscores back in for the hook name and register this pattern. $arg_name = isset($info['variables']) ? 'variables' : 'render element'; $implementations[strtr($file, '-', '_')] = array(