Revert a Drupal feature during deployment
To revert a features module during deployment, add an update hook and call features_revert with the name of the module and the component you want to revert.
This will revert panels_mini in the features module called "my_module" when you run update.php
You can find the name of the components in the features .info file, as follows:
features[component][] = "name"
So for a mini panel called "my_mini_panel", the .info file would have this line:
features[panels_mini][] = "my_mini_panel"
Now once you have deployed your feature to a new server, you just need to run update.php. The feature will revert to its code version. You would do this if you have changed a feature in your development environment and re-exported to code.
If you found this useful, you might like to sign up to my mailing list for tips on getting started with Drupal module development. Includes free Starting Drupal Module Development series (coming soon).
You might also be interested in my book - Master Drupal 7 Module Development.
Hello!
I am Blair Wadman and this where I share tutorials and trouble shooting guides.
My latest project is writing Master Drupal 7 Module Development, a book to help you conquer the sometimes baffling world of Drupal development.
Master Drupal Module Development - 20% off
Sick of all the Googling? Climb the learning curve faster and start module developing today.
Currently 20% off!
Comments
This is handy, thanks a lot!
This is handy, thanks a lot! Here's a little utility function which makes it a bit easier to completely revert features in an update hook:
https://gist.github.com/1925886
Thanks for the link to your
Thanks for the link to your gist Cameron. Looks good, I'm sure I'll use it. There is also a Drush hook to revert all features, which is handy if you want to revert everything in a deployment/rebuild.
Hi, I what location would
Hi,
I what location would this code go in?
In the .install file of a
In the .install file of a custom module
Add new comment