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?

Files: 
CommentFileSizeAuthor
#2 metatag-feature_revert-1840236-3.patch1.33 KBweri
PASSED: [[SimpleTest]]: [MySQL] 11 pass(es).
[ View ]

Comments

weri’s picture

Category:support» bug
Priority:Normal» Critical

I can confirm this problem, when the meta tag configuration is separated in different features.

weri’s picture

Status:Active» Needs review
StatusFileSize
new1.33 KB
PASSED: [[SimpleTest]]: [MySQL] 11 pass(es).
[ View ]

With this patch, only the metatag definitions from the feature get reverted.

DamienMcKenna’s picture

Status:Needs review» Fixed

Looks good, thanks for working out a fix for that. Committed.

BarisW’s picture

Status:Fixed» Needs review

Thanks for the patch. I can confirm that this patch works as expected. All my features are now back in default state.

weri’s picture

Status:Needs review» Fixed

Why did you set the status to 'needs review' when the patch is working and committed: http://drupalcode.org/project/metatag.git/commit/2805789

BarisW’s picture

Apologies, that's a cross-post. I had this thread open while testing the patch and Damien committed it in between ;)

Great work, and thanks!

DamienMcKenna’s picture

@BarisW: Thanks for the review.

DamienMcKenna’s picture

Status:Fixed» Closed (fixed)

Version 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!

Marty2081’s picture

Thanks all for getting this fixed so quickly!