You are here

function features_export_prepare in Features 6

Same name and namespace in other branches
  1. 7.2 features.export.inc \features_export_prepare()
  2. 7 features.export.inc \features_export_prepare()

Prepare a feature export array into a finalized info array.

2 calls to features_export_prepare()
features_detect_overrides in ./features.export.inc
Detect differences between DB and code components of a feature.
features_export_render in ./features.export.inc
Render feature export into an array representing its files.

File

./features.export.inc, line 141

Code

function features_export_prepare($export, $module_name, $reset = FALSE) {
  $existing = features_get_modules($module_name, $reset);

  // Prepare info string -- if module exists, merge into its existing info file
  $defaults = $existing ? $existing->info : array(
    'core' => '6.x',
    'package' => 'Features',
  );
  $export = array_merge($defaults, $export);

  // Cleanup info array
  foreach ($export['features'] as $component => $data) {
    $export['features'][$component] = array_keys($data);
  }
  if (isset($export['dependencies'])) {
    $export['dependencies'] = array_values($export['dependencies']);
  }
  if (isset($export['conflicts'])) {
    unset($export['conflicts']);
  }

  // Order info array.
  $standard_info = array();
  foreach (array(
    'name',
    'description',
    'core',
    'package',
    'php',
    'version',
    'project',
    'dependencies',
  ) as $item) {
    if (isset($export[$item])) {
      $standard_info[$item] = $export[$item];
    }
  }
  $export = array_diff_assoc($export, $standard_info);
  ksort($export);
  return array_merge($standard_info, $export);
}