You are here

function hook_features_rebuild in Features 7

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

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.

9 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.

dependencies_features_rebuild in includes/features.features.inc
Implements hook_features_rebuild(). Ensure that all of a feature's dependencies are enabled.
field_features_rebuild in includes/features.field.inc
Implements of hook_features_rebuild(). Rebuilds fields from code defaults.
filter_features_rebuild in includes/features.filter.inc
Implements hook_features_rebuild().
language_features_rebuild in includes/features.locale.inc
Implements hook_features_rebuild().
menu_custom_features_rebuild in includes/features.menu.inc
Implements hook_features_rebuild().

... See full list

File

./features.api.php, line 211

Code

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