You are here

protected function OptionalModuleManager::getInstallProfileFeatureDefinitions in Open Social 8.9

Same name and namespace in other branches
  1. 8.8 src/Installer/OptionalModuleManager.php \Drupal\social\Installer\OptionalModuleManager::getInstallProfileFeatureDefinitions()
  2. 10.3.x src/Installer/OptionalModuleManager.php \Drupal\social\Installer\OptionalModuleManager::getInstallProfileFeatureDefinitions()
  3. 10.0.x src/Installer/OptionalModuleManager.php \Drupal\social\Installer\OptionalModuleManager::getInstallProfileFeatureDefinitions()
  4. 10.1.x src/Installer/OptionalModuleManager.php \Drupal\social\Installer\OptionalModuleManager::getInstallProfileFeatureDefinitions()
  5. 10.2.x src/Installer/OptionalModuleManager.php \Drupal\social\Installer\OptionalModuleManager::getInstallProfileFeatureDefinitions()

Loads feature definitions from a `profile.feature_list.yml` in the profile.

This allows optional features to be defined for modules where it's not possible to add a `modulename.social_feature.yml` file to the module.

Return value

array An array containing the extra feature definitions, keyed by module name.

1 call to OptionalModuleManager::getInstallProfileFeatureDefinitions()
OptionalModuleManager::getOptionalModules in src/Installer/OptionalModuleManager.php
Collects the optionally installable modules for Open Social.

File

src/Installer/OptionalModuleManager.php, line 111

Class

OptionalModuleManager
Optional Module Manager.

Namespace

Drupal\social\Installer

Code

protected function getInstallProfileFeatureDefinitions() : array {
  $feature_list_name = $this->installProfile . '.installer_options_list.yml';
  $feature_list_file = $this->moduleExtensionList
    ->getPath($this->installProfile) . DIRECTORY_SEPARATOR . $feature_list_name;
  if (!file_exists($feature_list_file)) {
    return [];
  }
  $features = Yaml::decode(file_get_contents($feature_list_file));
  foreach ($features as $module_name => &$info) {

    // Validate the info so we know it won't cause any issues.
    $info += $this
      ->getInfoDefaults();
    try {
      $this
        ->validateSocialFeatureData($module_name, $info);
    } catch (SocialFeatureDataException $e) {
      throw new SocialFeatureDataException("Invalid feature info for '{$module_name}' in `{$feature_list_name}`.", 0, $e);
    }
  }
  return $features;
}