diff --git a/src/Form/ConfigSplitEntityForm.php b/src/Form/ConfigSplitEntityForm.php index d0f1ec0dc228a34aace9a838e218c2d2b2e9326a..649370af2ce16f03a41fbd86a6d5cd04792a7564 100644 --- a/src/Form/ConfigSplitEntityForm.php +++ b/src/Form/ConfigSplitEntityForm.php @@ -4,6 +4,8 @@ use Drupal\config_split\Config\StatusOverride; use Drupal\Core\Entity\EntityForm; +use Drupal\Core\Extension\ModuleExtensionList; +use Drupal\Core\Extension\ThemeExtensionList; use Drupal\Core\Extension\ThemeHandlerInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Site\Settings; @@ -30,11 +32,18 @@ class ConfigSplitEntityForm extends EntityForm { protected $state; /** - * Drupal\Core\Extension\ThemeHandler definition. + * The module list. * - * @var \Drupal\Core\Extension\ThemeHandlerInterface + * @var \Drupal\Core\Extension\ModuleExtensionList */ - protected $themeHandler; + protected $moduleExtensionList; + + /** + * The theme list. + * + * @var \Drupal\Core\Extension\ThemeExtensionList + */ + protected $themeExtensionList; /** * The entity being used by this form. @@ -50,17 +59,21 @@ class ConfigSplitEntityForm extends EntityForm { * The split status override service. * @param \Drupal\Core\State\StateInterface $state * The drupal state. - * @param \Drupal\Core\Extension\ThemeHandlerInterface $themeHandler - * The theme handler. + * @param \Drupal\Core\Extension\ModuleExtensionList $moduleExtensionList + * The module list. + * @param \Drupal\Core\Extension\ThemeExtensionList $themeExtensionList + * The theme list. */ public function __construct( StatusOverride $statusOverride, StateInterface $state, - ThemeHandlerInterface $themeHandler + ModuleExtensionList $moduleExtensionList, + ThemeExtensionList $themeExtensionList, ) { $this->statusOverride = $statusOverride; $this->state = $state; - $this->themeHandler = $themeHandler; + $this->moduleExtensionList = $moduleExtensionList; + $this->themeExtensionList = $themeExtensionList; } /** @@ -70,7 +83,8 @@ public static function create(ContainerInterface $container) { return new static( $container->get('config_split.status_override'), $container->get('state'), - $container->get('theme_handler') + $container->get('extension.list.module'), + $container->get('extension.list.theme'), ); } @@ -184,10 +198,10 @@ public function form(array $form, FormStateInterface $form_state) { recorded in a config patch saved in in the split storage."), ]; - $module_handler = $this->moduleHandler; + $module_handler = $this->moduleExtensionList; $modules = array_map(function ($module) use ($module_handler) { return $module_handler->getName($module->getName()); - }, $module_handler->getModuleList()); + }, $module_handler->getList()); // Add the existing ones with the machine name, so they do not get lost. foreach (array_diff_key($config->get('module'), $modules) as $missing => $weight) { $modules[$missing] = $missing; @@ -214,10 +228,10 @@ public function form(array $form, FormStateInterface $form_state) { ]; // We should probably find a better way for this. - $theme_handler = $this->themeHandler; + $theme_handler = $this->themeExtensionList; $themes = array_map(function ($theme) use ($theme_handler) { return $theme_handler->getName($theme->getName()); - }, $theme_handler->listInfo()); + }, $theme_handler->getList()); $form['complete_fieldset']['theme'] = [ '#type' => $multiselect_type, '#title' => $this->t('Themes'), diff --git a/tests/src/Kernel/NoPatchSplitMergeTest.php b/tests/src/Kernel/NoPatchSplitMergeTest.php index e1f0cee66850c3fa547befe3e5e0325d10403919..c5fcf279c533b92bc92b88800243530c438be4b0 100644 --- a/tests/src/Kernel/NoPatchSplitMergeTest.php +++ b/tests/src/Kernel/NoPatchSplitMergeTest.php @@ -68,7 +68,7 @@ protected function setUp(): void { * @return string[][] * The different storage types. */ - public function storageAlternativesProvider(): array { + public static function storageAlternativesProvider(): array { return [['folder'], ['collection'], ['database']]; } diff --git a/tests/src/Kernel/PatchSequenceTest.php b/tests/src/Kernel/PatchSequenceTest.php index 02fc5d5fb311295e91820c0d3a384569cce85530..0313b2dcb17b2878098e9b82f63044d93970a8dd 100644 --- a/tests/src/Kernel/PatchSequenceTest.php +++ b/tests/src/Kernel/PatchSequenceTest.php @@ -75,7 +75,7 @@ public function testSequencePatch(string $name, array $configA, array $configB, /** * Data provider for complex examples with a real schema. */ - public function sequenceProvider() { + public static function sequenceProvider() { $a = [ 'nested' => [ [ diff --git a/tests/src/Kernel/RolesSplittingTest.php b/tests/src/Kernel/RolesSplittingTest.php index 9cfdc8c441268e075fcdd21d48caeb1ac3e33c46..1dcb1afd091890f661e58c79fded687c0de020ab 100644 --- a/tests/src/Kernel/RolesSplittingTest.php +++ b/tests/src/Kernel/RolesSplittingTest.php @@ -121,10 +121,10 @@ public function testRoleSplit() { } /** - * Test splitting a role into multiple "feature-splits" + * Test splitting a role into multiple "feature-splits". */ public function testRoleMultiSplit() { - // We use shortcut and block to create the "feature-splits" + // We use shortcut and block to create the "feature-splits". $this->enableModules(['shortcut', 'block']); // Create a role with permissions from both modules. @@ -180,7 +180,6 @@ public function testRoleMultiSplit() { 'removing' => [], ]); - foreach (['feature_shortcut','feature_block'] as $id) { // Check if the split actually has the expected configs. $patch = $storage->createCollection('split.'.$id)->read('config_split.patch.user.role.test_role'); diff --git a/tests/src/Kernel/SplitContentEntityTypeTest.php b/tests/src/Kernel/SplitContentEntityTypeTest.php index c51da6cfe9e851487df87998630f1373f5e078f2..256bff5b051612586ac6fb37ad5aa26cf7653794 100644 --- a/tests/src/Kernel/SplitContentEntityTypeTest.php +++ b/tests/src/Kernel/SplitContentEntityTypeTest.php @@ -100,7 +100,7 @@ protected function setUp(): void { * @return string[][] * The different storage types. */ - public function storageAlternativesProvider(): array { + public static function storageAlternativesProvider(): array { return [['folder'], ['collection'], ['database']]; } diff --git a/tests/src/Kernel/SplitMergeTest.php b/tests/src/Kernel/SplitMergeTest.php index dfe073d9dd33f47d6ecb0ed348d6200a27add230..22184eda48b1d0e9f9827be346353034a0e24338 100644 --- a/tests/src/Kernel/SplitMergeTest.php +++ b/tests/src/Kernel/SplitMergeTest.php @@ -69,7 +69,7 @@ protected function setUp(): void { * @return string[][] * The different storage types. */ - public function storageAlternativesProvider(): array { + public static function storageAlternativesProvider(): array { return [['folder'], ['collection'], ['database']]; } diff --git a/tests/src/Kernel/SplitTestTrait.php b/tests/src/Kernel/SplitTestTrait.php index 43e10de56bd5089996cbf3f95d8a56317a5aabfe..77be06d36f98a8da7f78d7eabcf06adb088b2641 100644 --- a/tests/src/Kernel/SplitTestTrait.php +++ b/tests/src/Kernel/SplitTestTrait.php @@ -179,7 +179,8 @@ protected function validateImport(StorageInterface $storage): void { $container->get('module_installer'), $container->get('theme_handler'), $container->get('string_translation'), - $container->get('extension.list.module') + $container->get('extension.list.module'), + $container->get('extension.list.theme'), ); $importer->validate(); diff --git a/tests/src/Unit/ConfigPatchTest.php b/tests/src/Unit/ConfigPatchTest.php index 79221042fcb9d7af24682ba2ae2477c14ec006bf..68fea806c24906577deabda1f7272e443ff9f0f1 100644 --- a/tests/src/Unit/ConfigPatchTest.php +++ b/tests/src/Unit/ConfigPatchTest.php @@ -90,7 +90,7 @@ public function testStandardPatchMerge(array $configA, array $configB, ConfigPat * @return \Generator * The test cases. */ - public function standardPatchMergeProvider() { + public static function standardPatchMergeProvider() { yield 'deep merge' => [ 'configA' => [ 'dependencies' => ['a', 'b'],