You are here

function defaultconfig_modules_enabled in Default config 7

Implements hook_modules_enabled().

File

./defaultconfig.module, line 273
main module file.

Code

function defaultconfig_modules_enabled($modules) {

  // Allow distributions to disable this behavior and rebuild the features
  // manually inside a batch.
  if (!variable_get('features_rebuild_on_module_install', TRUE)) {
    return;
  }

  // We might not be able to install components while installing, so provide an option to disable
  // this functionality during installation.
  if (is_array($GLOBALS['install_state'])) {
    $profile = drupal_get_profile();
    $function = $profile . '_defaultconfig_site_install';
    if (function_exists($function) && !$function()) {
      return;
    }
  }

  // Make sure the list of available node types is up to date, especially when
  // installing multiple features at once, for example from an install profile
  // or via drush.
  node_types_rebuild();
  defaultconfig_include();
  drupal_static_reset();
  $components = defaultconfig_get_components(TRUE);
  foreach ($modules as $module) {
    foreach ($components as $component) {
      defaultconfig_component_include($component, $module);
      if (module_hook($module, $component['hook'])) {
        defaultconfig_component_rebuild($component, $module);
      }
    }
  }
}