You are here

function thunder_modules_installed in Thunder 8.5

Same name and namespace in other branches
  1. 8.2 thunder.profile \thunder_modules_installed()
  2. 8.3 thunder.profile \thunder_modules_installed()
  3. 8.4 thunder.profile \thunder_modules_installed()
  4. 6.2.x thunder.profile \thunder_modules_installed()
  5. 6.0.x thunder.profile \thunder_modules_installed()
  6. 6.1.x thunder.profile \thunder_modules_installed()

Implements hook_modules_installed().

File

./thunder.profile, line 126
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'],
        ]));
      }
    }
  }
}