You are here

function context_features_revert in Features 6

Same name and namespace in other branches
  1. 7.2 includes/features.context.inc \context_features_revert()
  2. 7 includes/features.context.inc \context_features_revert()

Implementation of hook_features_revert().

Parameters

$module: name of module to revert content for

File

includes/features.context.inc, line 206

Code

function context_features_revert($module = NULL) {

  // 3.x
  if (context_features_get_version() === 3) {
    $return = ctools_component_features_revert('context', $module);
    context_invalidate_cache();
    return $return;
  }

  // 2.x
  if ($default_contexts = features_get_default('context', $module)) {
    foreach ($default_contexts as $default_context) {
      $current_context = new StdClass();
      $current_context->namespace = $default_context['namespace'];
      $current_context->attribute = $default_context['attribute'];
      $current_context->value = $default_context['value'];
      $context_to_delete = context_load_context($current_context);
      context_delete_context($context_to_delete);
    }
  }
}