You are here

function hook_features_rebuild in Features 7.2

Same name and namespace in other branches
  1. 7 features.api.php \hook_features_rebuild()

Component hook. Rebuild all component objects for a given feature module.

Should only be implemented for 'faux-exportable' components.

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

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.

12 functions implement hook_features_rebuild()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

contact_categories_features_rebuild in includes/features.contact.inc
Implements hook_features_rebuild().
dependencies_features_rebuild in includes/features.features.inc
Implements hook_features_rebuild(). Ensure that all of a feature's dependencies are enabled.
field_base_features_rebuild in includes/features.field.inc
Implements of hook_features_rebuild(). Rebuilds fields from code defaults.
field_features_rebuild in includes/features.field.inc
Implements of hook_features_rebuild(). Rebuilds fields from code defaults.
field_instance_features_rebuild in includes/features.field.inc
Implements of hook_features_rebuild(). Rebuilds field instances from code defaults.

... See full list

File

./features.api.php, line 264
Hooks provided by the features module.

Code

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