diff --git a/core/modules/system/src/Controller/SystemController.php b/core/modules/system/src/Controller/SystemController.php
index 9a6327edb6..2e969feaa6 100644
--- a/core/modules/system/src/Controller/SystemController.php
+++ b/core/modules/system/src/Controller/SystemController.php
@@ -247,17 +247,19 @@ public function themesPage() {
if ($incompatible = ModulesListForm::checkDependencyMessage($modules, $dependency, $version)) {
$theme->module_dependencies[$dependency] = $incompatible;
$theme->incompatible_module = TRUE;
+ continue;
}
// Only display visible modules.
elseif (!empty($modules[$dependency]->hidden)) {
unset($theme->module_dependencies[$dependency]);
+ continue;
} else {
$name = $modules[$dependency]->info['name'];
if ($modules[$dependency]->status) {
- $theme->module_dependencies[$dependency] = $this->t('@module', array('@module' => $name));
+ $theme->module_dependencies[$dependency] = $this->t('@module', ['@module' => $name]);
}
else {
- $theme->module_dependencies[$dependency] = $this->t('@module (disabled)', array('@module' => $name));
+ $theme->module_dependencies[$dependency] = $this->t('@module (disabled)', ['@module' => $name]);
}
}
}
diff --git a/core/modules/system/src/Controller/ThemeController.php b/core/modules/system/src/Controller/ThemeController.php
index 4eef7f020d..e62fae9ab7 100644
--- a/core/modules/system/src/Controller/ThemeController.php
+++ b/core/modules/system/src/Controller/ThemeController.php
@@ -7,6 +7,7 @@
use Drupal\Core\Config\UnmetDependenciesException;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\DrupalKernelInterface;
+use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Extension\ThemeHandlerInterface;
use Drupal\Core\Messenger\MessengerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -25,13 +26,6 @@ class ThemeController extends ControllerBase {
*/
protected $themeHandler;
- /**
- * The messenger.
- *
- * @var \Drupal\Core\Messenger\MessengerInterface
- */
- protected $messenger;
-
/**
* The Drupal kernel.
*
@@ -48,14 +42,11 @@ class ThemeController extends ControllerBase {
* The config factory.
* @param \Drupal\Core\DrupalKernelInterface $kernel
* The drupal kernel.
- * @param \Drupal\Core\Messenger\MessengerInterface $messenger
- * The messenger.
*/
- public function __construct(ThemeHandlerInterface $theme_handler, ConfigFactoryInterface $config_factory, DrupalKernelInterface $kernel, MessengerInterface $messenger) {
+ public function __construct(ThemeHandlerInterface $theme_handler, ConfigFactoryInterface $config_factory, DrupalKernelInterface $kernel) {
$this->themeHandler = $theme_handler;
$this->configFactory = $config_factory;
$this->kernel = $kernel;
- $this->messenger = $messenger;
}
/**
@@ -131,7 +122,8 @@ public function install(Request $request) {
if (isset($theme)) {
try {
- $previously_installed_modules = \Drupal::moduleHandler()->getModuleList();
+ // Ensure we always have the latest
+ $previously_installed_modules = $this->moduleHandler()->getModuleList();
if ($this->themeHandler->install([$theme])) {
$this->refreshServices();
$theme_data = $this->themeHandler->listInfo();
@@ -241,6 +233,7 @@ protected function refreshServices() {
$this->messenger = $container->get('messenger');
$this->themeHandler = $container->get('theme_handler');
$this->configFactory = $container->get('config.factory');
+ $this->moduleHandler = $container->get('module_handler');
}
}
diff --git a/core/modules/system/src/Form/ModulesListForm.php b/core/modules/system/src/Form/ModulesListForm.php
index 960a7e2ab7..c851cb31e1 100644
--- a/core/modules/system/src/Form/ModulesListForm.php
+++ b/core/modules/system/src/Form/ModulesListForm.php
@@ -217,9 +217,8 @@ public static function checkDependencyMessage(array $modules, $dependency, $vers
'@version' => $modules[$dependency]->info['version'],
]);
}
- // Disable the checkbox if the dependency is incompatible with this
- // version of Drupal core.
- elseif ($modules[$dependency]->info['core'] != \Drupal::CORE_COMPATIBILITY) {
+ // Ensure that one cannot install
+ if ($modules[$dependency]->info['core'] != \Drupal::CORE_COMPATIBILITY) {
return t('@module (incompatible with this version of Drupal core)', [
'@module' => $name,
]);
@@ -340,7 +339,7 @@ protected function buildRow(array $modules, Extension $module, $distribution) {
foreach ($module->requires as $dependency => $version) {
// Only display missing or visible modules.
if (empty($modules[$dependency]->hidden)) {
- if ($incompatible = $this->checkDependencyMessage($modules, $dependency, $version)) {
+ if ($incompatible = static::checkDependencyMessage($modules, $dependency, $version)) {
$row['#requires'][$dependency] = $incompatible;
$row['enable']['#disabled'] = TRUE;
}