Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem
Per documentation in metatag.migrate.inc
I use the following lines to migrate metatag data:
$this->addFieldMapping('metatag_description', 'meta_description');
$this->addFieldMapping('metatag_abstract', 'meta_abstract');
The result in metatag
table is following:
entity_type | entity_id | revision_id | language | data
node | 399 | 399 | abstract | a:1:{s:5:"value";s:13:"meta abstract";}
node | 399 | 399 | description | a:1:{s:5:"value";s:16:"meta description";}
As you can see, language value is missing. The metatag is also not showing in the source of the node.
If I save the node normally, I see the following entry in metatag
table (with language prefix):
entity_type | entity_id | revision_id | language | data
node | 398 | 398 | und | a:2:{s:11:"description";a:1:{s:5:"value";s:16:"meta description";}s:8:"abstract";a:1:{s:5:"value";s:13:"meta abstract";}}
Solution
Solution would be to include the entity language when migrating the metatag for the entity.
Comment | File | Size | Author |
---|---|---|---|
#1 | metatag-migrate-incl-language-2411549-1.patch | 673 bytes | maijs |
Comments
Comment #1
maijs CreditAttribution: maijs commentedThe patch against
7.x-1.x
is attached.Comment #2
maijs CreditAttribution: maijs commentedComment #3
DamienMcKennaThanks for finding that and going to the effort of putting together a patch, I appreciate it! I'll take a look at it soon.
PS, please don't forget to change the status to "Needs review" when you upload a patch, that'll tell me (and others) you have something to be reviewed.
Comment #4
DamienMcKennaCommitted. Thanks!