You are here

protected function OptionalModuleManager::getOptionalModuleInfo in Open Social 8.8

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

Load the optional module info for the extension.

Parameters

\Drupal\Core\Extension\Extension $extension: The extension to get the info for.

Return value

array|null An array with the info about the optional module or null if it's not an optional module.

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

File

src/Installer/OptionalModuleManager.php, line 144

Class

OptionalModuleManager
Optional Module Manager.

Namespace

Drupal\social\Installer

Code

protected function getOptionalModuleInfo(Extension $extension) : ?array {
  $module_directory = $extension
    ->getPath();
  $optional_info_file = $module_directory . DIRECTORY_SEPARATOR . $extension
    ->getName() . '.installer_options.yml';
  if (!file_exists($optional_info_file)) {
    return NULL;
  }

  // We don't catch the InvalidDataTypeException thrown here because we have
  // no better info to give developers about invalid Yaml files.
  $feature_info = Yaml::decode(file_get_contents($optional_info_file));

  // Add our defaults to the data.
  $feature_info += $this
    ->getInfoDefaults();

  // Validate the data that we've found.
  if (!$this
    ->validateSocialFeatureData($extension
    ->getName(), $feature_info)) {
    return NULL;
  }
  return $feature_info;
}