diff --git a/core/lib/Drupal/Core/Extension/ModuleInstaller.php b/core/lib/Drupal/Core/Extension/ModuleInstaller.php index 760dd5b6f8..a6cf5b7fb9 100644 --- a/core/lib/Drupal/Core/Extension/ModuleInstaller.php +++ b/core/lib/Drupal/Core/Extension/ModuleInstaller.php @@ -77,7 +77,7 @@ public function __construct($root, ModuleHandlerInterface $module_handler, Drupa $this->moduleHandler = $module_handler; $this->kernel = $kernel; if (is_null($extension_list_theme)) { - @trigger_error('The extension.list.theme service must be passed to ' . __NAMESPACE__ . '\ModuleInstaller::__construct. It was added in Drupal 8.9.0 and will be required before Drupal 10.0.0.', E_USER_DEPRECATED); + @trigger_error('The extension.list.theme service must be passed to ' . __NAMESPACE__ . '\ModuleInstaller::__construct(). It was added in drupal 8.9.0 and will be required before drupal 10.0.0.', E_USER_DEPRECATED); $extension_list_theme = \Drupal::service('extension.list.theme'); } $this->themeExtensionList = $extension_list_theme; diff --git a/core/lib/Drupal/Core/Extension/ModuleRequiredByThemesUninstallValidator.php b/core/lib/Drupal/Core/Extension/ModuleRequiredByThemesUninstallValidator.php index 0598b031e1..86499f55ca 100644 --- a/core/lib/Drupal/Core/Extension/ModuleRequiredByThemesUninstallValidator.php +++ b/core/lib/Drupal/Core/Extension/ModuleRequiredByThemesUninstallValidator.php @@ -51,7 +51,7 @@ public function validate($module) { $themes_depending_on_module = $this->getThemesDependingOnModule($module); if (!empty($themes_depending_on_module)) { $module_name = $this->moduleExtensionList->get($module)->info['name']; - $theme_names = implode(", ", $themes_depending_on_module); + $theme_names = implode(', ', $themes_depending_on_module); $reasons[] = $this->formatPlural(count($themes_depending_on_module), 'Required by the theme: @theme_names', 'Required by the themes: @theme_names', diff --git a/core/lib/Drupal/Core/Extension/ThemeInstaller.php b/core/lib/Drupal/Core/Extension/ThemeInstaller.php index 0fa79fa7a3..9d61a4df97 100644 --- a/core/lib/Drupal/Core/Extension/ThemeInstaller.php +++ b/core/lib/Drupal/Core/Extension/ThemeInstaller.php @@ -113,7 +113,7 @@ public function __construct(ThemeHandlerInterface $theme_handler, ConfigFactoryI $this->logger = $logger; $this->state = $state; if ($module_extension_list === NULL) { - @trigger_error('The extension.list.module service must be passed to ' . __NAMESPACE__ . '\ThemeInstaller::__construct. It was added in Drupal 8.9.0 and will be required before Drupal 10.0.0.', E_USER_DEPRECATED); + @trigger_error('The extension.list.module service must be passed to ' . __NAMESPACE__ . '\ThemeInstaller::__construct(). It was added in drupal 8.9.0 and will be required before drupal 10.0.0.', E_USER_DEPRECATED); $module_extension_list = \Drupal::service('extension.list.module'); } $this->moduleExtensionList = $module_extension_list; @@ -126,8 +126,8 @@ public function install(array $theme_list, $install_dependencies = TRUE) { $extension_config = $this->configFactory->getEditable('core.extension'); $theme_data = $this->themeHandler->rebuildThemeData(); - $installed_themes = $this->configFactory->get('core.extension')->get('theme') ?: []; - $installed_modules = $this->configFactory->get('core.extension')->get('module') ?: []; + $installed_themes = $extension_config->get('theme') ?: []; + $installed_modules = $extension_config->get('module') ?: []; if ($install_dependencies) { $theme_list = array_combine($theme_list, $theme_list); @@ -143,8 +143,8 @@ public function install(array $theme_list, $install_dependencies = TRUE) { return TRUE; } + $module_list = $this->moduleExtensionList->getList(); foreach ($theme_list as $theme => $value) { - $module_list = $this->moduleExtensionList->getList(); $module_dependencies = $theme_data[$theme]->module_dependencies; $theme_dependencies = array_diff_key($theme_data[$theme]->requires, $module_dependencies); $unmet_module_dependencies = array_diff_key($module_dependencies, $installed_modules); diff --git a/core/modules/system/src/Controller/SystemController.php b/core/modules/system/src/Controller/SystemController.php index 7e04f4c61d..5942ff3ce0 100644 --- a/core/modules/system/src/Controller/SystemController.php +++ b/core/modules/system/src/Controller/SystemController.php @@ -266,9 +266,8 @@ public function themesPage() { continue; } - // @todo add logic for not displaying hidden modules in - // https://drupal.org/node/3117829 - + // @todo Add logic for not displaying hidden modules in + // https://drupal.org/node/3117829. $module_name = $modules[$dependency]->info['name']; $theme->module_dependencies_list[$dependency] = $modules[$dependency]->status ? $this->t('@module_name', ['@module_name' => $module_name]) : $this->t('@module_name (disabled)', ['@module_name' => $module_name]); diff --git a/core/modules/system/src/Form/ModulesListForm.php b/core/modules/system/src/Form/ModulesListForm.php index c23bbc8915..d0c0a6fbb2 100644 --- a/core/modules/system/src/Form/ModulesListForm.php +++ b/core/modules/system/src/Form/ModulesListForm.php @@ -329,9 +329,8 @@ protected function buildRow(array $modules, Extension $module, $distribution) { // If this module requires other modules, add them to the array. /** @var \Drupal\Core\Extension\Dependency $dependency_object */ foreach ($module->requires as $dependency => $dependency_object) { - // @todo add logic for not displaying hidden modules in - // https://drupal.org/node/3117829 - + // @todo Add logic for not displaying hidden modules in + // https://drupal.org/node/3117829. if ($incompatible = $this->checkDependencyMessage($modules, $dependency, $dependency_object)) { $row['#requires'][$dependency] = $incompatible; $row['enable']['#disabled'] = TRUE; diff --git a/core/modules/system/tests/src/Functional/Form/ModulesListFormWebTest.php b/core/modules/system/tests/src/Functional/Form/ModulesListFormWebTest.php index 5d5c7b3c91..f17ca8db1f 100644 --- a/core/modules/system/tests/src/Functional/Form/ModulesListFormWebTest.php +++ b/core/modules/system/tests/src/Functional/Form/ModulesListFormWebTest.php @@ -87,12 +87,7 @@ public function testRequiredByThemeMessage() { * Creates user that can administer modules then visits `admin/modules`. */ protected function createUserAdministerModules() { - $this->drupalLogin( - $this->drupalCreateUser( - ['administer modules', 'administer permissions'] - ) - ); - + $this->drupalLogin($this->drupalCreateUser(['administer modules', 'administer permissions'])); $this->drupalGet('admin/modules'); $this->assertSession()->statusCodeEquals(200); } diff --git a/core/modules/system/tests/src/Functional/Theme/ThemeUiTest.php b/core/modules/system/tests/src/Functional/Theme/ThemeUiTest.php index 1578f6dad6..b27fc124b3 100644 --- a/core/modules/system/tests/src/Functional/Theme/ThemeUiTest.php +++ b/core/modules/system/tests/src/Functional/Theme/ThemeUiTest.php @@ -16,6 +16,11 @@ class ThemeUiTest extends BrowserTestBase { */ protected $defaultTheme = 'stark'; + /** + * Modules used for testing. + * + * @var array + */ protected $testModules = [ 'help' => 'Help', 'test_module_required_by_theme' => 'Test Module Required by Theme', @@ -286,9 +291,8 @@ protected function assertUninstallableTheme(array $expected_requires_list_items, $this->assertTrue(in_array($item->getText(), $expected_requires_list_items)); } - $incompatible = $theme_container->find('css', '.incompatible'); $expected_incompatible_text = 'This theme requires the listed modules to operate correctly. They must first be enabled via the Extend page.'; - $this->assertSame($expected_incompatible_text, $incompatible->getText()); + $this->assertSession()->elementContains('css', '.incompatible', $expected_incompatible_text); $this->assertFalse($theme_container->hasLink('Install Test Theme Depending on Modules theme')); }