From e748ee2ad7c25c45fc3f6b70c3d0440f03374497 Mon Sep 17 00:00:00 2001 From: Nathaniel Catchpole <catch@35733.no-reply.drupal.org> Date: Fri, 6 Mar 2015 10:50:29 +0000 Subject: [PATCH] Issue #2443817 by andypost, a_thakur: Remove usage and the function drupal_theme_access() --- core/includes/theme.inc | 22 ------------------- .../system/src/Tests/Theme/ThemeTest.php | 7 ++---- core/modules/system/system.module | 7 ------ 3 files changed, 2 insertions(+), 34 deletions(-) diff --git a/core/includes/theme.inc b/core/includes/theme.inc index b6078ed79a1c..c7dff02ed2af 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -70,28 +70,6 @@ * @} End of "defgroup content_flags". */ -/** - * Determines if a theme is available to use. - * - * @param string|\Drupal\Core\Extension\Extension $theme - * Either the name of a theme or a full theme object. - * - * @return bool - * Boolean TRUE if the theme is installed or is the site administration theme; - * FALSE otherwise. - * - * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0. - * Use \Drupal::service('access_check.theme')->checkAccess(). - * - * @see \Drupal\Core\Theme\ThemeAccessCheck::checkAccess(). - */ -function drupal_theme_access($theme) { - if ($theme instanceof Extension) { - $theme = $theme->getName(); - } - return \Drupal::service('access_check.theme')->checkAccess($theme); -} - /** * Gets the theme registry. * diff --git a/core/modules/system/src/Tests/Theme/ThemeTest.php b/core/modules/system/src/Tests/Theme/ThemeTest.php index 4573d01c8aaa..0cd4e4ebef2d 100644 --- a/core/modules/system/src/Tests/Theme/ThemeTest.php +++ b/core/modules/system/src/Tests/Theme/ThemeTest.php @@ -207,12 +207,9 @@ function testListThemes() { $theme_handler->install(array('test_subtheme')); $themes = $theme_handler->listInfo(); - $themes = \Drupal::service('theme_handler')->listInfo(); - // Check if drupal_theme_access() retrieves enabled themes properly from - // ThemeHandlerInterface::listInfo(). - $this->assertTrue(drupal_theme_access('test_theme'), 'Installed theme detected'); + // Check if ThemeHandlerInterface::listInfo() retrieves enabled themes. + $this->assertIdentical(1, $themes['test_theme']->status, 'Installed theme detected'); - $this->assertTrue(drupal_theme_access('test_theme'), 'Enabled theme detected'); // Check if ThemeHandlerInterface::listInfo() returns disabled themes. // Check for base theme and subtheme lists. $base_theme_list = array('test_basetheme' => 'Theme test base theme'); diff --git a/core/modules/system/system.module b/core/modules/system/system.module index a0fa679c19ef..cf175ca251c0 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -314,13 +314,6 @@ function system_theme_suggestions_field(array $variables) { return $suggestions; } -/** - * Menu item access callback - only installed themes can be accessed. - */ -function _system_themes_access($theme) { - return \Drupal::currentUser()->hasPermission('administer themes') && drupal_theme_access($theme); -} - /** * @defgroup authorize Authorized operations * @{ -- GitLab