You are here

function content_features_revert in Default Content 7

Same name and namespace in other branches
  1. 7.2 defaultcontent.features.inc \content_features_revert()

Implements hook_features_revert().

1 call to content_features_revert()
content_features_rebuild in ./defaultcontent.features.inc
Implements hook_features_rebuild().

File

./defaultcontent.features.inc, line 56
Handles all features exporting functionality

Code

function content_features_revert($module_name) {
  $components = module_invoke($module_name, 'content_defaults');
  usort($components, 'defaultcontent_import_sort');
  if (!empty($components)) {
    foreach ($components as $component) {
      if ($nid = defaultcontent_get_default($component->machine_name)) {
        $node = node_load($nid, NULL, TRUE);
        $node = defaultcontent_export_node_process($node);

        //check if the node has change before we blow it away

        //and reimport
        if ($node != $component) {
          entity_get_controller('node')
            ->resetCache();
          node_delete($nid);
          defaultcontent_import_node($component);
        }
      }
      else {
        defaultcontent_import_node($component);
      }
    }
  }
  return TRUE;
}