Hi, I am having problems reverting features containing metatag configuration. I have the situation that we store settings in features per functionality. E.g. we have a news feature and a blog feature. The news feature contains the metatag configuration for the news_item node type and the blog feature contains the metatag configuration for the blog_article node type. When I revert either one of those features the other feature gets overridden and the metatag settings from that feature are 'lost'.
I looked at the implementation of hook_feature_revert() in metatag.features.inc and I am wondering if that implementation is correct. From what I can tell every time a feature is reverted ALL metatag configuration ($default_config is iterated through and a db_delete() is performed on each $default_config item) is deleted and only the configuration from the feature that is being reverted is re-added (also resulting in undefined index errors, since the feature might not always contain the same items as the default config).
I got my issue resolved by commenting out the line getting the default config and replacing $default_config by $feature_conf in the foreach(). This will make sure only the config that is in the feature is deleted and re-added. I am not sure if that is a solid solution though, since you might want to also delete any configuration that is no longer valid/exported in a feature.
Any thoughts?
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | metatag-feature_revert-1840236-3.patch | 1.33 KB | weri |
Comments
Comment #1
weri commentedI can confirm this problem, when the meta tag configuration is separated in different features.
Comment #2
weri commentedWith this patch, only the metatag definitions from the feature get reverted.
Comment #3
damienmckennaLooks good, thanks for working out a fix for that. Committed.
Comment #4
BarisW commentedThanks for the patch. I can confirm that this patch works as expected. All my features are now back in default state.
Comment #5
weri commentedWhy did you set the status to 'needs review' when the patch is working and committed: http://drupalcode.org/project/metatag.git/commit/2805789
Comment #6
BarisW commentedApologies, that's a cross-post. I had this thread open while testing the patch and Damien committed it in between ;)
Great work, and thanks!
Comment #7
damienmckenna@BarisW: Thanks for the review.
Comment #8
damienmckennaVersion 7.x-1.0-beta3 has been released and includes this work. Am closing this issue in an effort to keep the issue queue clean. Thank you all for your continued help!
Comment #9
marty2081 commentedThanks all for getting this fixed so quickly!