You are here

function configuration_export_render in Configuration Management 7

Render feature export into an array representing its files.

Parameters

$export: An exported feature definition.

$reset: Boolean flag for resetting the module cache. Only set to TRUE when doing a final export for delivery.

Return value

array of info file and module file contents.

4 calls to configuration_export_render()
configuration_delete_multiple in ./configuration.module
Delete a specific configuration from being tracked.
configuration_download_config in ./configuration.admin.inc
Download the entire configuration packaged up into zip file
configuration_download_diff in ./configuration.admin.inc
Download a unified diff.
configuration_write_exports in ./configuration.export.inc
Writes configurations to disk.
2 string references to 'configuration_export_render'
configuration_export_render_hooks in ./configuration.export.inc
Generate an array of hooks and their raw code.
configuration_get_normal in ./configuration.export.inc
Get normal objects for a given module/component pair.

File

./configuration.export.inc, line 181

Code

function configuration_export_render($export, $reset = FALSE) {
  $code = array();

  // Generate hook code
  $module_name = 'configuration';
  $component_hooks = configuration_export_render_hooks($export, $module_name, $reset);
  $components = configuration_get_components();

  // Group component code into their respective files
  foreach ($component_hooks as $component => $hooks) {
    $file = array(
      'name' => 'configuration',
    );
    if (isset($components[$component]['default_file'])) {
      switch ($components[$component]['default_file']) {
        case CONFIGURATION_DEFAULTS_INCLUDED:
          $file['name'] = "configuration.{$component}";
          break;
        case CONFIGURATION_DEFAULTS_CUSTOM:
          $file['name'] = $components[$component]['default_filename'];
          break;
      }
    }
    if (!isset($code[$file['name']])) {
      $code[$file['name']] = array();
    }
    foreach ($hooks as $hook_name => $hook_code) {
      $code[$file['name']][$hook_name] = configuration_export_render_defaults($module_name, $hook_name, $hook_code);
    }
  }

  // Finalize strings to be written to files
  foreach ($code as $filename => $contents) {
    $code[$filename] = "<?php\n/**\n * @file\n * {$filename}.inc\n */\n\n" . implode("\n\n", $contents) . "\n";
  }
  return $code;
}