diff --git a/group.install b/group.install index 5e262f4..62f8de2 100644 --- a/group.install +++ b/group.install @@ -7,9 +7,11 @@ use Drupal\group\Entity\GroupContent; use Drupal\Core\Config\ExtensionInstallStorage; +use Drupal\Core\Config\FileStorage; use Drupal\Core\Config\InstallStorage; use Drupal\Core\Entity\EntityTypeListenerInterface; use Drupal\Core\Entity\Sql\SqlContentEntityStorage; +use Drupal\views\Entity\View; /** * Resave all GroupContent labels and remove orphaned entities. @@ -451,3 +453,24 @@ function group_update_8015() { } } } + +/** + * Import the configuration for the membership request feature. + */ +function group_update_8016() { + $module_handler = \Drupal::moduleHandler(); + if ($module_handler->moduleExists('views')) { + $optional_install_path = $module_handler->getModule('group') + ->getPath() . '/' . InstallStorage::CONFIG_OPTIONAL_DIRECTORY; + $storage = new FileStorage($optional_install_path); + if (!View::load('group_pending_members')) { + $view_config = $storage->read('views.view.group_pending_members'); + if (!empty($view_config)) { + \Drupal::entityTypeManager() + ->getStorage('view') + ->create($view_config) + ->save(); + } + } + } +} diff --git a/tests/src/Kernel/GroupTypeTest.php b/tests/src/Kernel/GroupTypeTest.php index bbd1880..4825af1 100644 --- a/tests/src/Kernel/GroupTypeTest.php +++ b/tests/src/Kernel/GroupTypeTest.php @@ -55,7 +55,7 @@ class GroupTypeTest extends GroupKernelTestBase { public function testGetInstalledContentPlugins() { $plugins = $this->groupType->getInstalledContentPlugins(); $this->assertInstanceOf('\Drupal\group\Plugin\GroupContentEnablerCollection', $plugins, 'Loaded the installed plugin collection.'); - $this->assertCount(1, $plugins, 'Plugin collection has one plugin instance.'); + $this->assertCount(2, $plugins, 'Plugin collection has two plugin instances.'); } /**