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.
As mentioned over at #1282620: Integration with i18n for per-language defaults, comment #33, we need to add a new "language" column to the DB and then make sure it gets used properly in order to support Entity Translation.
The other issue does not deal with tags for specific entities. That's the problem we're trying to fix here.
Comment | File | Size | Author |
---|---|---|---|
#42 | metatag-n1688286-42.patch | 17.12 KB | DamienMcKenna |
#41 | metatag-n1688286-41.patch | 15.02 KB | DamienMcKenna |
#40 | metatag-n1688286-40.patch | 14.72 KB | DamienMcKenna |
#31 | metatags.png | 475.5 KB | mgifford |
#28 | add_entity_translation_to_meta_tags-1688286-28.patch | 18.2 KB | colan |
Comments
Comment #1
colanHere's the DB-altering portion; more to come.
Comment #2
colanComment #3
colanAs it turns out, the function signatures didn't need to be changed.
I think I've got the display portion sorted. Feel free to begin testing it. The next big challenge will be to get the saving of the data working, both on the entity create/edit form and on the ET translation form. Things will hopefully be somewhat easier now that #1224590: Introduce entity translation CRUD hooks has been committed.
Comment #4
mgiffordChanging this for the bot. Thanks for resubmitting the patch Colan.
Comment #5
colanEntity-specific tags can now be added, updated, and deleted in the default language. Now onto dealing with other languages...
@mgifford: The tests should fail as this isn't done yet. If you want more confidence in the batch testing, I'd recommend helping add some tests that make it fail. ;)
Comment #6
plachThe new Entity Translation UI will deal with all languages automatically if you use the new entity_language() core function...
Comment #7
colan@plach: As that's not guaranteed to be there, I've been doing a lot of this:
$foo = function_exists('entity_language') ? entity_language($entity_type, $entity) : $entity->language;
Please let me know if it makes sense the way I'm using it.
Here's the latest code. I had to make a bunch of minor changes (like showing the entity's language on the translation form if the translation's tags haven't been set yet.) Hopefully, everything should be in there except for the ET hooks which need implementing. I'll get to these next:
Comment #8
colanGot the update() one done. One down; two to go.
Comment #9
colanAll done. Please test and provide feedback.
I had to fix the original delete function as it wasn't actually deleting anything:
Comment #10
janiskam CreditAttribution: janiskam commentedGreat job, colan! That's what I've been looking for. BTW you have to uninstall the previous metatag version, to propagate the schema changes to database (I didn't think of it at first and got an error after applying the patch).
Comment #11
DamienMcKennaSeeing as this has a pretty good patch available, lets try to get this into the stable release.
Comment #12
colan@janiskam: That's not necessary. Simply run update.php or use Drush.
Comment #13
guysaban CreditAttribution: guysaban commentedHi Colan (#9),
Would you be able to provide a patch file for the latest release version of metatag module 7.x-1.0-alpha7 ?
All the best,
Guy
Comment #14
colanSorry, no time right now, but it does look like it needs to be re-rolled.
Comment #15
mgifford#9: add_entity_translation_to_meta_tags-1688286-9.patch queued for re-testing.
Comment #17
guysaban CreditAttribution: guysaban commentedThanks mgifford for requeueing the patch.
How do we see the test results?
Comment #18
mgifford#9: add_entity_translation_to_meta_tags-1688286-9.patch queued for re-testing.
Comment #19
mgiffordIt said it couldn't apply, but that didn't make any sense. So I re-submitted it.
The results are available from:
http://qa.drupal.org/pifr/test/305803
Comment #21
guysaban CreditAttribution: guysaban commentedThanks.
I looked at the log but did not find anything that helps me understand why the test failed.
Here's an excerpt from the end of the log:
Comment #22
mgiffordI think there's a problem with the git repository in general
I just get that one file.....
Comment #23
alejandro_oses CreditAttribution: alejandro_oses commentedHere i add the patch of colan wrapped on the final module, working.
thanks colan
Alejandro Oses
www.rootstack.com
Comment #24
Summit CreditAttribution: Summit commentedHi,
Will the module from #23 be integrated in metatag?
I am using latest .dev metatag of 2012-Aug-26
greetings, Martijn
Comment #25
guysaban CreditAttribution: guysaban commentedMaybe someone can try re-roll Colans patch (http://drupal.org/node/1688286#comment-6274460) for the most recent version of the metatag module or maybe for the dev version?
Comment #26
janiskam CreditAttribution: janiskam commentedI haven't created a patch, however I manually applied the changes in Colans patch to the latest Dev version of metatag. All seems fine to me but you should use the code at your own risk!
Comment #27
guysaban CreditAttribution: guysaban commentedThanks janiskam.
I see that it does not add the additional language field (column) to the metatag table in the DB. I had to do it manually. Maybe this is stopping it from getting in to a dev release?
I rechecked. after manually building the langauge field and using the reworked module it did not work. I added content to the English field. worked. But when I added content to the Spanish entity it kept the original English content. May someone could give some input. I would be happy to check but don't know where to look.
Comment #28
colanI needed the latest dev version so I had to re-roll this.
Comment #29
mgiffordI applied this against the 7.x-1.x git repository and got:
So, I wanted to see if I could get a screenshot of this and thought I'd be able to see it here:
admin/config/search/metatags/config/node
I couldn't see it. Maybe it's because I had no data there. Anyways, just looking for better ways to test this and mark it RTBC.
Also adding i18n tag as this is that type of issue.
Comment #30
colanThose warnings/errors conflict with Indenting and Whitespace which states:
I could take them out, but then I'd be in violation of the coding standards.
@mgifford: To test it, do the following:
Comment #31
mgiffordJust to confirm, you want this done the old school way for translation as a node and not as a field "Enabled, with field translation"
In which case, this seems to work fine. I've attached a screenshot.
Comment #32
colanI have it working with entity translation, not node translation, so I'm not sure how it would be old-school? Node translation may work as well, but I've never tested that so I have no idea if it would work.
Comment #33
guysaban CreditAttribution: guysaban commentedHi Colan,
I used the latest dev version with your patch.
The patch went smooth as follows:
I then did a db update:
drush updb
and got:
When I manually added the column in the DB and tested the changes did not save.
The English (default language) metatags worked fine.
When I went to the Spanish metatag entities they had the same info as the English. I tried to change and save but they kept the English info.
Comment #34
mkalkbrennerPatch #28 seems to work here. But a small remaining issue is the title of the vertical tab on the content edit page which still says "Meta tags (all languages)"
Comment #35
plachYou need a
'#multilingual'
key set to TRUE in the metatag fieldset.Comment #36
guysaban CreditAttribution: guysaban commentedHi Plach,
Why is it necessary to add the key? what does it effect? (I am asking to learn more about this key).
All the best,
Guy
Comment #37
plachIt's stuff added in the latest Entity Translation -dev: http://drupalcode.org/project/entity_translation.git/blob/refs/heads/7.x....
Comment #38
DamienMcKennaHas anyone tested this patch with the new beta1 of Entity Translation?
Comment #39
DamienMcKennaThis needs to be rerolled against the current codebase.
Comment #40
DamienMcKennaRerolled.
Comment #41
DamienMcKennaThis includes the '#multilingual'=>TRUE bit that was needed, per plach.
Comment #42
DamienMcKennaThis version has some small coding format tweaks, and replaces the module_load_include() call with a simpler include_once().
Comment #43
DamienMcKennaI tested this and it worked as advertised. Great work Colan! Committed!
Comment #44
guysaban CreditAttribution: guysaban commentedI tested this on a development site where it worked well. It is now working well on a production server.
My previous error mentioned above in #33 was due to a database problem - not a problem with the module.
Thanks to everyone that got this going, especially Colan, and to DamienMcKenna for putting a focus on it as part of his role for maintaining this module.
Comment #45
garrettc CreditAttribution: garrettc commentedWorking here on quite a large multilingual development site. Great work.
Comment #46
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 #47
lpeabody CreditAttribution: lpeabody commentedI get the same error as in #33 when doing a `drush up` as of today. It is trying to upgrade to beta1 from alpha8.
Comment #48
lpeabody CreditAttribution: lpeabody commentedTo get around the problem I opted to do the following instead:
I was then able to run `drush up` and successfully update the rest of my modules and update the database as well.
Comment #49
Kristen PolI'm using Entity Translation 7.x-1.0-beta1 and the latest Meta tags dev and ET+meta tags is not working. Is there something else that needs to be done besides running update.php? Has anyone confirmed that the latest Meta tags works with ET beta1 or later?
Comment #50
Kristen PolI have upgraded to the latest Entity Translation dev version and tested further and here's the behavior:
1) Go to French page
2) Clear the cache
3) French meta tags show up on French page
4) Switch to English page
5) French meta tags show up on English page
6) Clear the cache
7) English meta tags show up on English page
8) Switch to French page
8) English meta tags show up on French page
:/
Should this be on this issue or should I open a new issue?
Comment #51
DamienMcKennaKristen: Please take a look at #1845326: Metatags not loading correctly with beta4. Thanks.
Comment #52
Kristen PolThanks Damien... I'm following up there.
Comment #53
j0rd CreditAttribution: j0rd commentedBecause of this query, metatag is not longer query'ing over MySQL indexes. At least according to my MySQL slow log.
To shut MySQL up, I've had to add these indexes.
I noticed because I have a site with like 40,000 nodes and started doing a bulk delete and mysql slow logs went nuts.
Comment #54
DamienMcKenna@j0rd: Please open a new issue rather than posting unrelated comments on an issue that was closed almost three months ago. Thanks.
Comment #55
Adam Clarey CreditAttribution: Adam Clarey commentedI'm having a big problem with this module on PHP 5.4.
in metatag.module at line 76 there is the code:
$hooks_entity_translation = array(
'entity_translation_insert',
'entity_translation_update',
'entity_translation_delete',
);
$hooks_entity_translation = array_fill_keys($hooks_entity_translation, array('group' => 'entity_translation'));
To add the above data to the 'hook_info' array generated in module_hook_info. The problem is that the entity translation module is also adding these hooks to the array meaning in hook info you see:
{entity_translation_insert :
{group :
0 : 'entity_translation',
1 : 'entity_translation'
}
}
Instead of being just:
{entity_translation_insert :
{group : 'entity_translation'}
}
Which it needs to be. The problem occurs later in module_implements() - includes/module.inc at line 709:
$include_file = isset($hook_info[$hook]['group']) && module_load_include('inc', $module, $module . '.' . $hook_info[$hook]['group']);
Because $hook_info[$hook]['group'] is now an array and not a string, it throws out a long list of errors:
Notice: Array to string conversion in module_implements() (line 709 of ~/includes/module.inc).
My question is, is the above code in metatag.module actually needed if it is being added by the entity_translation module? And if so, then there needs to be a way around this problem.
Adam
Comment #56
DamienMcKenna@rabbit_media: Please don't post unrelated questions on a closed issue, instead please open a new issue. Thanks.
Comment #56.0
DamienMcKennaAdded link to ET's project page.