diff --git a/core/includes/theme.inc b/core/includes/theme.inc index e8cff8b..b9080b7 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1204,8 +1204,9 @@ function _template_preprocess_default_variables() { 'logged_in' => FALSE, ); - // Give modules a chance to alter the default template variables. + // Give modules & themes a chance to alter the default template variables. \Drupal::moduleHandler()->alter('template_preprocess_default_variables', $variables); + \Drupal::themeHandler()->alter('template_preprocess_default_variables', $variables); // Tell all templates where they are located. $variables['directory'] = \Drupal::theme()->getActiveTheme()->getPath(); @@ -1259,6 +1260,7 @@ function template_preprocess_html(&$variables) { $system_path = \Drupal::service('path.current')->getPath(); $variables['root_path'] = explode('/', $system_path)[1]; } + $variables['base_path'] = base_path(); $site_config = \Drupal::config('system.site'); // Construct page title. diff --git a/core/modules/system/templates/html.html.twig b/core/modules/system/templates/html.html.twig index 39702c2..43ce0ce 100644 --- a/core/modules/system/templates/html.html.twig +++ b/core/modules/system/templates/html.html.twig @@ -5,6 +5,8 @@ * * Variables: * - logged_in: A flag indicating if user is logged in. + * - base_path: The base URL path of the Drupal installation. Will usually be + * "/" unless you have installed Drupal in a sub-directory. * - root_path: The root path of the current page (e.g., node, admin, user). * - node_type: The content type for the current node, if the page is a node. * - head_title: List of text elements that make up the head_title variable. diff --git a/core/themes/classy/templates/layout/html.html.twig b/core/themes/classy/templates/layout/html.html.twig index b787ed1..2ba07b7 100644 --- a/core/themes/classy/templates/layout/html.html.twig +++ b/core/themes/classy/templates/layout/html.html.twig @@ -5,6 +5,8 @@ * * Variables: * - logged_in: A flag indicating if user is logged in. + * - base_path: The base URL path of the Drupal installation. Will usually be + * "/" unless you have installed Drupal in a sub-directory. * - root_path: The root path of the current page (e.g., node, admin, user). * - node_type: The content type for the current node, if the page is a node. * - head_title: List of text elements that make up the head_title variable.