You are here

public static function FeaturesHelper::revert in Helper 7

Deprecated

Use features_revert_module($module) instead.

2 calls to FeaturesHelper::revert()
FeaturesHelper::revertAll in lib/FeaturesHelper.php
FeaturesHelperTestCase::testRevert in tests/FeaturesHelperTestCase.test

File

lib/FeaturesHelper.php, line 10

Class

FeaturesHelper

Code

public static function revert(array $modules, $force = FALSE) {
  module_load_include('inc', 'features', 'features.export');
  features_include(TRUE);
  $items = array();
  $states = features_get_component_states($modules, TRUE, TRUE);
  $restore_states = array(
    FEATURES_OVERRIDDEN,
    FEATURES_REBUILDABLE,
    FEATURES_NEEDS_REVIEW,
  );
  foreach ($states as $module_name => $components) {
    foreach ($components as $component => $state) {
      if ($force || in_array($state, $restore_states)) {
        if (!isset($items[$module_name])) {
          $items[$module_name] = array();
        }
        $items[$module_name][] = $component;
      }
    }
  }
  if (!empty($items)) {
    return features_revert($items);
  }
}