You are here

public static function ConfigurationManagement::exportToDataStore in Configuration Management 7.2

Export the configuration from the ActiveStore to the DataStore.

Parameters

array $list: The list of components that have to will be exported.

boolean $import_dependencies: If TRUE, dependencies of each proccessed configuration will be exported too.

boolean $import_optionals: If TRUE, optionals configurations of each proccessed configuration will be exported too.

boolean $star_tracking: If TRUE, after export the configuration, it will be also tracked.

Return value

ConfigIteratorSettings An ConfigIteratorSettings object that contains the exported configurations.

10 calls to ConfigurationManagement::exportToDataStore()
ConfigurationApiTest::testExportToDatastore in tests/configuration.test
ConfigurationHandlerBaseTestCase::testExportToDataStore in tests/handlers/ConfigurationHandlerBaseTestCase.test
Import a configuration from the ActiveStore to the DataStore.
ConfigurationHandlerMenuLinksTestCase::testExportToDataStore in tests/handlers/menu_links.test
ConfigurationHandlerPageManagerTestCase::testExportToDataStore in tests/handlers/page_manager.test
ConfigurationHandlerVariableTestCase::testExportToDataStore in tests/handlers/vocabularies.test

... See full list

File

lib/Drupal/configuration/Config/ConfigurationManagement.php, line 329
Definition of Drupal\configuration\Config\ConfigurationManagement.

Class

ConfigurationManagement

Namespace

Drupal\configuration\Config

Code

public static function exportToDataStore($list = array(), $export_dependencies = TRUE, $export_optionals = TRUE, $start_tracking = FALSE) {
  $excluded = static::excludedConfigurations();
  $settings = new ConfigIteratorSettings(array(
    'build_callback' => 'build',
    'callback' => 'export',
    'process_dependencies' => $export_dependencies,
    'process_optionals' => $export_optionals,
    'settings' => array(
      'start_tracking' => $start_tracking,
      'excluded' => $excluded,
    ),
    'info' => array(
      'modules' => array(),
      'exported' => array(),
      'hash' => array(),
    ),
  ));
  module_invoke_all('configuration_pre_export', $settings);
  foreach ($list as $component) {
    if (in_array($component, $excluded)) {
      continue;
    }
    $config = static::createConfigurationInstance($component);

    // Make sure the object is built before start to iterate on its
    // dependencies.
    $config
      ->setContext($settings);
    $config
      ->build();
    $config
      ->iterate($settings);
  }

  // Even if we are exporting only a few configurations, all tracked
  // configurations should be considered while creating the list of required
  // modules.
  if ($start_tracking) {
    $modules = array();
    foreach (array_keys(static::trackedConfigurations(FALSE)) as $config_id) {
      $config = static::createConfigurationInstance($config_id);
      $config
        ->build();
      $modules = array_merge($modules, array_keys($config
        ->getRequiredModules()));
    }
    array_merge($modules, $settings
      ->getInfo('modules'));
    static::updateTrackingFile($modules);
  }
  module_invoke_all('configuration_post_export', $settings);
  return $settings;
}