You are here

function configuration_include_defaults in Configuration Management 7

Load features includes for all components that require includes before collecting defaults.

3 calls to configuration_include_defaults()
configuration_find_new in ./configuration.module
Look for any configurations that might be new
configuration_get_default in ./configuration.export.inc
Get defaults for a given module/component pair.
configuration_get_default_map in ./configuration.export.inc
Get a map of components to their providing modules.

File

./configuration.module, line 348
Module file for the configuration module, which enables the capture and management of configuration in Drupal.

Code

function configuration_include_defaults($components = NULL, $reset = FALSE) {
  static $included = array();
  static $include_components;

  // Build an array of components that require inclusion:
  // Views, CTools components and those using FEATURES_DEFAULTS_INCLUDED.
  if (!isset($include_components) || $reset) {
    $include_components = configuration_get_components();
    foreach ($include_components as $component => $info) {
      if ($component !== 'views' && !isset($info['api']) && (!isset($info['default_file']) || $info['default_file'] !== CONFIGURATION_DEFAULTS_INCLUDED)) {
        unset($include_components[$component]);
      }
    }
  }

  // If components are specified, only include for the specified components.
  if (isset($components)) {
    $components = is_array($components) ? $components : array(
      $components => $components,
    );
  }
  else {
    $components = $include_components;
  }
  foreach (array_keys($components) as $component) {
    if (isset($include_components[$component]) && (!isset($included[$component]) || $reset)) {
      $info = $include_components[$component];

      // Inclusion of defaults for Views.
      if ($component === 'views') {
        views_include('view');
        views_include_handlers();
        views_module_include('views_default.inc');
      }
      elseif (isset($info['api'], $info['module'], $info['current_version'])) {
        ctools_include('plugins');
        ctools_plugin_api_include($info['module'], $info['api'], $info['current_version'], $info['current_version']);
        $file = 'config://configuration.' . $component . '.inc';
        if (is_file($file)) {
          include_once drupal_realpath($file);
        }
      }
      else {
        $file = "config://configuration.{$component}.inc";
        if (is_file($file)) {
          include_once drupal_realpath($file);
        }
      }
      $included[$component] = TRUE;
    }
  }

  // Inclusion of the catch all config file
  $file = "config://configuration.inc";
  if (is_file($file)) {
    include_once drupal_realpath($file);
  }
}