1. Create a node with source language english, give it custom meta
  2. create a translation of a node in french (for example) in a new revision, give it custom meta
  3. create a new revision of the english version while reverting to the default metatag

Bug: the french version is loosing its custom meta

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

SebCorbin’s picture

Another maybe related bug:

  1. Consider the previous scenario
  2. Revert the revision where both languages had custom meta while current language is french

Bug: another revision is created, but the english version has the french custom meta

SebCorbin’s picture

Status: Active » Needs review
FileSize
3.46 KB

Patch solving the first problem. Just state your mind, don't commit, I've still some performance improvements to do.

Also if you could explain this part (line 426):

  // Ensure the data saves during node_save().
  if (isset($metatags[$langcode])) {
    // There are certain occasions when the old data and the new data are
    // *both* added to the $metatags array, in this case throw away the language
    // data.
    $lang_data = $metatags[$langcode];
    unset($metatags[$langcode]);
    if (empty($metatags)) {
      $metatags = $lang_data;
    }
  }

That's actually what's causing the second bug (but in the same function)

SebCorbin’s picture

And here is another one, with performance fix and trying to mitigate "these certain occasions"

SebCorbin’s picture

+++ b/metatag.module
@@ -442,6 +444,37 @@ function metatag_metatags_save($entity_type, $entity_id, $revision_id, $metatags
+            'language'    => $lang->language,

Typo here

DamienMcKenna’s picture

Component: Integration with other module » Multilingual/intl
Parent issue: » #2175021: META: Plan for Metatag 7.x-1.0-rc1 release

We actually have a category for internationalization/multilingual support :)

Thanks for putting this together, I'll review it shortly.

DamienMcKenna’s picture

Minor tweak.

DamienMcKenna’s picture

Priority: Normal » Critical

Data loss == critical, sorry for not noticing that earlier.

rmunsky’s picture

Maybe it is not related to this issue but we have a similar behaviour.

Even if we have just activate ML settings on a node so we can specify a language there but no translation the custom meta data gets deleted after a node gets published with the scheduler module.

Could you give me some information if this post here is related to this? Its, sure, also kind of very important for us not to loose the custom meta data when getting a ml enabled node live.

rmunsky’s picture

an update: if i save a node with set schedule settings before it gets published automatically, the meta data remains to be there properly.

DamienMcKenna’s picture

@rmunsky: Did you test the patch above?

  • DamienMcKenna committed 98c58fd on 7.x-1.x
    Issue #2285787 by SebCorbin: Entity Translation problems with revisions.
    

  • DamienMcKenna committed 5d2e2f3 on 7.x-1.x
    Revert "Issue #2285787 by SebCorbin: Entity Translation problems with...
  • DamienMcKenna committed d7bed1e on 7.x-1.x authored by SebCorbin
    Issue #2285787 by SebCorbin: Entity Translation problems with revisions.
    
DamienMcKenna’s picture

Status: Needs review » Fixed

Committed (twice, because I forgot to give proper attribution to Seb). Thanks SebCorbin!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.