You are here

function features_populate in Features 7.2

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

Populates an export array with additional keys.

Parameters

array $info: Feature info array Format: $['features'][$component][$name] = $name $['dependencies'][$dependency] = $dependency.

string $module_name: Module name of the feature being generated.

Return value

array Fully populated export array. Format: $['features']['features_api']['api:' . FEATURES_API] = TRUE $['features'][$component][$name] = $name $['dependencies'][$dependency] = $dependency $['conflicts'] = [..] $['features_exclude'][$component][$name] = $name

5 calls to features_populate()
FeaturesDetectionTestCase::test in tests/features.test
Run test.
features_detect_overrides in ./features.export.inc
Detect differences between DB and code components of a feature.
features_export_components_json in ./features.admin.inc
Page callback for 'features/ajaxcallback/%'.
_drush_features_generate_export in ./features.drush.inc
Helper function for _drush_feature_export.
_features_export_build in ./features.admin.inc
Return the full feature export array based upon user selections in form_state.

File

./features.export.inc, line 28
Contains functions that export configuration into feature modules.

Code

function features_populate($info, $module_name) {

  // Sanitize items.
  $items = !empty($info['features']) ? array_filter($info['features']) : array();
  $items['dependencies'] = !empty($info['dependencies']) ? drupal_map_assoc(array_filter($info['dependencies'])) : array();

  // Populate stub.
  $stub = array(
    'features' => array(),
    'dependencies' => array(),
    'conflicts' => array(),
  ) + $info + array(
    'features_exclude' => array(),
  );
  $export = _features_populate($items, $stub, $module_name, TRUE);

  // Add Features API version. Any module with this entry in the .info file
  // will be treated as a Feature and included in the admin/build/features UI.
  $export['features']['features_api']['api:' . FEATURES_API] = TRUE;

  // Allow other modules to alter the export.

  /* @see \hook_features_export_alter() */
  drupal_alter('features_export', $export, $module_name);

  // Clean up and standardize order.
  foreach (array_keys($export['features']) as $k) {
    ksort($export['features'][$k]);
  }
  ksort($export['features']);
  ksort($export['dependencies']);
  ksort($export['features_exclude']);
  return $export;
}