You are here

function _features_populate in Features 6

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

Iterate and descend into a feature definition to extract module dependencies and feature definition. Calls hook_features_export for modules that implement it.

Parameters

$pipe: Associative of array of module => info-for-module

$export: Associative array of items, and module dependencies which define a feature. Passed by reference.

Return value

fully populated $export array.

2 calls to _features_populate()
drush_features_add in ./features.drush.inc
Add a component to a features module.
features_populate in ./features.export.inc

File

./features.export.inc, line 43

Code

function _features_populate($pipe, &$export, $module_name = '') {
  features_include();
  foreach ($pipe as $component => $data) {

    // Convert already defined items to dependencies.
    _features_resolve_dependencies($data, $export, $module_name, $component);
    if (!empty($data) && ($function = features_hook($component, 'features_export'))) {

      // Pass module-specific data and export array.
      // We don't use features_invoke() here since we need to pass $export by reference.
      $more = $function($data, $export, $module_name, $component);

      // Allow other modules to manipulate the pipe to add in additional modules.
      drupal_alter('features_pipe_' . $component, $more, $data, $export);

      // Allow for export functions to request additional exports.
      if (!empty($more)) {
        _features_populate($more, $export, $module_name);
      }
    }
  }
  return $export;
}