Last active
March 26, 2019 06:53
-
-
Save becw/4121388 to your computer and use it in GitHub Desktop.
Enable/revert a feature in a Drupal update hook #drupal7
This file contains hidden or 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
/** | |
* EXAMPLE FEATURE UPDATE | |
* Enable and revert the my_new_feature_name feature. | |
*/ | |
function example_update_7001() { | |
// An array of new or changed features; the array keys are feature names, | |
// values are an array of exportable types as seen in a feature's .info file: | |
// features[field][] = node-page-body | |
$features = array( | |
'my_new_feature_name' => array('field', 'variable'), | |
'my_other_feature' => array('taxonomy'), | |
); | |
// Enable the modules by name. | |
module_enable(array_keys($features)); | |
// Revert the features (if the feature has been changed) | |
features_revert($features); | |
return t('Enabled the my_new_feature_name and my_other_feature features.'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment