public function OptionalModuleManager::getOptionalModules in Open Social 8.8
Same name and namespace in other branches
- 8.9 src/Installer/OptionalModuleManager.php \Drupal\social\Installer\OptionalModuleManager::getOptionalModules()
- 10.3.x src/Installer/OptionalModuleManager.php \Drupal\social\Installer\OptionalModuleManager::getOptionalModules()
- 10.0.x src/Installer/OptionalModuleManager.php \Drupal\social\Installer\OptionalModuleManager::getOptionalModules()
- 10.1.x src/Installer/OptionalModuleManager.php \Drupal\social\Installer\OptionalModuleManager::getOptionalModules()
- 10.2.x src/Installer/OptionalModuleManager.php \Drupal\social\Installer\OptionalModuleManager::getOptionalModules()
Collects the optionally installable modules for Open Social.
A module is optionally installable if it contains a `modulename.social_feature.yml` file. The file should contain data about the module and information to help a user decide whether it's needed. The `default` key can be used to determine whether the feature is selected by default (default: false) and `weight` can be used to arrange features in a certain order, lower is higher (default: 0).
Below is an example. ``` name: Search Autocomplete description: Show interactive search suggestions in the search overlay. default: true ```
Return value
array An array containing the information about the optional module keyed by module name.
File
- src/
Installer/ OptionalModuleManager.php, line 78
Class
- OptionalModuleManager
- Optional Module Manager.
Namespace
Drupal\social\InstallerCode
public function getOptionalModules() : array {
$optional_modules = [];
$available_modules = $this->moduleExtensionList
->getList();
$install_profile_features = $this
->getInstallProfileFeatureDefinitions();
// Loop over each available module to check if it can be enabled as optional
// Open Social feature.
foreach ($available_modules as $name => $extension) {
$module_info = $this
->getOptionalModuleInfo($extension);
// If the module has feature info, add it.
if ($module_info !== NULL) {
$optional_modules[$name] = $module_info;
}
elseif (isset($install_profile_features[$name])) {
$optional_modules[$name] = $install_profile_features[$name];
}
}
return $optional_modules;
}