function thunder_modules_installed in Thunder 6.2.x
Same name and namespace in other branches
- 8.5 thunder.profile \thunder_modules_installed()
- 8.2 thunder.profile \thunder_modules_installed()
- 8.3 thunder.profile \thunder_modules_installed()
- 8.4 thunder.profile \thunder_modules_installed()
- 6.0.x thunder.profile \thunder_modules_installed()
- 6.1.x thunder.profile \thunder_modules_installed()
Implements hook_modules_installed().
File
- ./thunder.profile, line 77 
- Enables modules and site configuration for a thunder site installation.
Code
function thunder_modules_installed($modules) {
  if (!InstallerKernel::installationAttempted() && !Drupal::isConfigSyncing()) {
    /** @var \Drupal\Core\Extension\ModuleExtensionList $moduleExtensionList */
    $moduleExtensionList = \Drupal::service('extension.list.module');
    $thunder_features = array_filter($moduleExtensionList
      ->getList(), function (Extension $module) {
      return $module->info['package'] === 'Thunder Optional';
    });
    foreach ($thunder_features as $id => $extension) {
      $dependencies = array_map(function ($dependency) {
        return Dependency::createFromString($dependency)
          ->getName();
      }, $extension->info['dependencies']);
      if (!in_array($id, $modules) && !empty(array_intersect($modules, $dependencies))) {
        \Drupal::messenger()
          ->addWarning(t('To get the full Thunder experience, we recommend to install the @module module. See all supported optional modules at <a href="/admin/modules/extend-thunder">Thunder Optional modules</a>.', [
          '@module' => $extension->info['name'],
        ]));
      }
    }
  }
}