diff --git a/core/includes/theme.inc b/core/includes/theme.inc index bb70fc8..d65784a 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1408,11 +1408,15 @@ function theme_get_setting($setting_name, $theme = NULL) { // Generate the path to the logo image. if ($cache[$theme]->get('features.logo')) { - $logo_path = $cache[$theme]->get('logo.path'); if ($cache[$theme]->get('logo.use_default')) { - $cache[$theme]->set('logo.url', file_create_url(dirname($theme_object->filename) . '/logo.png')); + if (!file_exists($logo_path = dirname($theme_object->filename) . '/logo.png')) { + $logo_path = FALSE; + } } - elseif ($logo_path) { + else { + $logo_path = $cache[$theme]->get('logo.path'); + } + if ($logo_path) { $query_string_separator = (strpos($logo_path, '?') !== FALSE) ? '&' : '?'; $cache[$theme]->set('logo.url', file_create_url($logo_path) . $query_string_separator . $query_string); } @@ -1420,24 +1424,21 @@ function theme_get_setting($setting_name, $theme = NULL) { // Generate the path to the favicon. if ($cache[$theme]->get('features.favicon')) { - $favicon_path = $cache[$theme]->get('favicon.path'); if ($cache[$theme]->get('favicon.use_default')) { - if (file_exists($favicon = dirname($theme_object->filename) . '/favicon.ico')) { - $cache[$theme]->set('favicon.url', file_create_url($favicon)); + if (!file_exists($favicon_path = dirname($theme_object->filename) . '/favicon.ico')) { + $favicon_path = 'core/misc/favicon.ico'; } - else { - $cache[$theme]->set('favicon.url', file_create_url('core/misc/favicon.ico')); - } - } - elseif ($favicon_path) { - $cache[$theme]->set('favicon.url', file_create_url($favicon_path)); } else { - $cache[$theme]->set('features.favicon', FALSE); + $favicon_path = $cache[$theme]->get('favicon.path'); } - if (!empty($favicon_path)) { + if ($favicon_path) { $query_string_separator = (strpos($favicon_path, '?') !== FALSE) ? '&' : '?'; - $cache[$theme]['favicon'] = $favicon_path . $query_string_separator . $query_string; + $favicon_url = file_create_url($favicon_path) . $query_string_separator . $query_string; + $cache[$theme]->set('favicon.url', $favicon_url); + } + else { + $cache[$theme]->set('features.favicon', FALSE); } } } diff --git a/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php b/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php index bafcd9b..b1a6a37 100644 --- a/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php @@ -49,7 +49,7 @@ function testThemeSettings() { $file_relative = strtr($file->uri, array('public:/' => PublicStream::basePath())); $default_theme_path = 'core/themes/stark'; - // Logos and favicons receive a query string. + // Logos and favicons receive a query-string. try { $query_string = \Drupal::state()->get('system.css_js_query_string') ?: '0'; }