Created
June 23, 2015 22:17
-
-
Save carlwiedemann/46da9573b9d6bef1d4e1 to your computer and use it in GitHub Desktop.
reverts a feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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