Skip to content

Instantly share code, notes, and snippets.

@carlwiedemann
Created June 23, 2015 22:17
Show Gist options
  • Save carlwiedemann/46da9573b9d6bef1d4e1 to your computer and use it in GitHub Desktop.
Save carlwiedemann/46da9573b9d6bef1d4e1 to your computer and use it in GitHub Desktop.
reverts a feature
/**
* Reverts feature by name. Apparently it's not a thing. Let's make it a thing.
*
* @param string $name
* Machine name of the feature to revert.
*/
function _foobar_revert_feature($name) {
$feature = features_load_feature($name, TRUE);
$components = array();
foreach (array_keys($feature->info['features']) as $component) {
if (features_hook($component, 'features_revert')) {
$components[] = $component;
}
}
foreach ($components as $component) {
features_revert(array($name => array($component)));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment