Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Since updating from 3.0 to 3.4, any path_to_theme() or $directory prints the path of bootstrap rather then the subtheme.
I've temporary fixed it by adding this to my functions file:
function THEME_preprocess_page(&$vars) {
$vars['theme_path'] = $vars['base_path'] . $vars['directory'];
}
and manually going through each .tpl file and replacing path_to_theme() with $theme_path.
Is this a bug with the bootstrap update or am I going to have to update all future sites this way?
Thanks
Comments
Comment #2
markhalliwellThis is technically a bug with
path_to_theme()
in core itself. You should never use that function. For a proper solution, use:$theme_path = drupal_get_path('theme', 'my_subtheme');
Or:
$theme_path = drupal_get_path('theme', $GLOBALS['theme']);
However, I wouldn't use this as you might have the same issue like
path_to_theme()
does.See https://api.drupal.org/api/drupal/includes%21theme.inc/function/path_to_...