You are here

function hook_features_export_rebuild in Features 6

Component hook. The hook should be implemented using the name ot the component, not the module, eg. [component]_features_export() rather than [module]_features_export().

Rebuild all component objects for a given feature module. Should only be implemented for 'faux-exportable' components.

This hook is called at points where Features determines that it is safe (ie. the feature is in state `FEATURES_REBUILDABLE`) for your module to replace objects in the database with defaults that you collect from your own defaults hook. See API.txt for how Features determines whether a rebuild of components is possible.

Parameters

string $module_name: The name of the feature module whose components should be rebuilt.

File

./features.api.php, line 203

Code

function hook_features_export_rebuild($module_name) {
  $mycomponents = module_invoke_all($module_name, 'mycomponent_defaults');
  if (!empty(${$mycomponents})) {
    foreach ($mycomponents as $mycomponent) {
      mycomponent_save($mycomponent);
    }
  }
}