public function HabitatSubscriber::ensureModulesEnabled in Habitat 8
1 call to HabitatSubscriber::ensureModulesEnabled()
- HabitatSubscriber::ensureHabitat in src/
EventSubscriber/ HabitatSubscriber.php
File
- src/
EventSubscriber/ HabitatSubscriber.php, line 39 - Contains \Drupal\habitat\EventSubscriber\HabitatSubscriber.
Class
Namespace
Drupal\habitat\EventSubscriberCode
public function ensureModulesEnabled($habitat) {
$installed_modules = \Drupal::config('habitat.settings')
->get('habitat_install_' . $habitat);
if (count($installed_modules)) {
$module_installer = \Drupal::service('module_installer');
foreach ($installed_modules as $module) {
if (!\Drupal::moduleHandler()
->moduleExists($module)) {
$module_installer
->install(array(
$module,
));
\Drupal::logger('habitat')
->info('%module was installed for the %habitat habitat', array(
'%module' => $module,
'%habitat' => $habitat,
));
}
}
}
}