Posted by rudiedirkx on December 21, 2012 at 10:41am
2 followers
Jump to:
| Project: | Features |
| Version: | 7.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
There's one function (features_revert()) to do anything between revert 1 component in 1 feature and revert all components in all features. There's no function that reverts all components in 1 feature. I miss that. Is that something to add?
I'm currently using this in update hooks a lot:
<?php
function features_revert_module($module) {
if (($feature = feature_load($module, TRUE)) && module_exists($module)) {
$components = array();
foreach (array_keys($feature->info['features']) as $component) {
if (features_hook($component, 'features_revert')) {
$components[] = $component;
}
}
features_revert(array($module => $components));
}
}
?>Idea?
Comments
#1
I Just used this function for the same scenario and thought it would make a worthy addition. Thanks!