Drupal 7.18
i18n 1.7 & 1.8
Pathautho 1.2 & 1.x-dev
Steps to reproduce:
1. Add new node in default language. Alias is generated well and works. There is only one nuance - it is language neutral.
2. Add a translation for that node. After adding alias for default language will be lost because there is no alias for that language in database. Alias for translation is generated well in correct language.
3. If you edit default language for that node and set "Generate automatic alias" (because it is bacame unset after translation addition) than the alias will be generated well for default language too.
I think this is related to ET because if I switch node translation type from "Enabled, with field translation" to "Enabled, with translation" alias is generated well in default language after 1'st step.
Comment | File | Size | Author |
---|---|---|---|
#8 | entitytranslation-incorrect_pathauto_pattern-1925848-8.patch | 686 bytes | Bußmeyer |
Comments
Comment #1
Merlineus CreditAttribution: Merlineus commentedIt seems that issue is related to drupal core.
For some reason entity_language() returns und for newly created node. On node update return value is correct.
On local system all works fine.
Comment #2
Merlineus CreditAttribution: Merlineus commentedNo, it's not in core.
entity_translation_current_form_get_handler() returns empty handler when called from pathauto_entity_language().
Comment #3
Merlineus CreditAttribution: Merlineus commentedThe problem introduced in the dev version.
Fallback to beta2 fixes the issue.
It is related to changes in entity_translation_language.
Comment #4
Merlineus CreditAttribution: Merlineus commentedThis patch breakes alias generation http://drupal.org/files/et-incorrect_et_handler-1851118-4.patch
Comment #5
plachCannot reproduce this: tested with the latest dev of Core, ET, Pathauto and Token. Please provide the exact steps to reproduce this on a clean installation.
Comment #6
joel_osc CreditAttribution: joel_osc commentedI am seeing this too and downgrading to beta2 fixed the issue. I think it is something with the patch mentioned in #4, because when I step through it in the debugger in includes/translation.handler.inc:: function getLanguage $this->entity is only the default entity object with no nid, title, language, etc. defined even though this gets called after node_save so the $node object is already populated with an nid and language well before.
I will see if I can get more information on a minimal configuration which induces the issue.
Comment #7
plachCan you try the patch at #1865244: Allow multiple translation handlers on the same form? It's apparently unrelated but it deeply refactors handler instantiation so it may fix this (and break many more things ;)
Comment #8
Bußmeyer CreditAttribution: Bußmeyer commentedI can reproduce this.
The method isWrappedEntity() tries to compare the entity type and id of the current entity and the entity information in the EntityTranslationHandler object.
The function entity_translation_language() is called twice. On the submission of the edit form and through pathauto. In the first run there is no entity id in the entity nor in the entity information of the EntityTranslationHandler object. The return value of the method isWrappedEntity() is true.
When pathauto calls entity_translation_language() the entity id is set in the entity but not in the entity information of the EntityTranslationHandler object.
My patch tries to fix this and updates the entity information of the EntityTranslationHandler object.
Comment #9
Bußmeyer CreditAttribution: Bußmeyer commentedComment #10
plachCan you please try #1865244: Allow multiple translation handlers on the same form and see whether it fixes this issue? Since it's touching the same code I'd wish to avoid committing a conflicting patch.
Comment #11
eidoscompatch on #8 works for me. Applied and after bulk update the urls are correct!!! Thanks!
Comment #12
plachJust to clarify: #8 won't be committed if I don't get a feedback about #10.
Comment #13
eidoscomI removed patch in #8 and applied the patch in #10.
Applying, it throw me some errors:
After bulk update the urls are not correct.
Comment #14
eidoscomI must apply to dev??
I applied in 7.x-1.0-beta2
Comment #15
eidoscomInstalled dev, applied path from #10 but after bulk alias update, the tokens are not getting the correct language:
With dev version an patch #10 applied, patch in #8 failed to apply and then we can't see if it works...
Comment #16
plachOk, thanks for the test. The two patches are somehow conflicting and we need a solution that will work even with #1865244: Allow multiple translation handlers on the same form applied.
Meanwhile it would be good to know how to reproduce this issue.
Comment #17
milesw CreditAttribution: milesw commentedThis problem isn't specific to Pathauto, I experienced symptoms using Rules. Field values for new nodes appear to be empty in Rules when they are actually populated. Existing nodes are fine, this is only newly inserted nodes. Tracked it down to entity_language() and entity_translation_language(), as described by other posters here.
The patch in #8 resolves the issue for me. The patch in #1865244: Allow multiple translation handlers on the same form does resolve the issue as well.
Steps to reproduce:
Comment #18
milesw CreditAttribution: milesw commentedChanging status.
Comment #19
das-peter CreditAttribution: das-peter commentedI had the same issue.
How I reproduced it:
node:title-field
url_alias
to ensure the proper language is set.With the latest patch from #1865244-29: Allow multiple translation handlers on the same form to problem seems to be solved!
At least now I get an alias in the proper language after node creation instead one with language neutral (
und
).An stepping through the code shows that
entity_language()
now returns the proper language in e.g.hook_node_insert()
.I didn't check bulk alias update though.
@eidoscom: Did you try
[node:title-field]
as token?[node:title]
can be a bit tricky because it's handled by the title module.Comment #20
plach#1865244: Allow multiple translation handlers on the same form went in. Please check whether this is fixed now.
Comment #20.0
plachPathautho 1.x-dev also tested
Comment #21
guillaumev CreditAttribution: guillaumev commentedI had the same issue but, after upgrading to entity_translation 1.x-dev and clearing the caches, it went away. I'm marking this as fixed.
Comment #23
timme77 CreditAttribution: timme77 commentedPatch #8 works fine for me!
Comment #24
brendan.hurley CreditAttribution: brendan.hurley commentedPatch #8 also works for me...
It was pathauto that brought the issue to my attention, after debugging I noticed that entity_language was returning LANGUAGE_NONE on node insert, when it really should have been 'en', this actually causes no path to be generated in my case.
In the comments above someone mentions entity_translation_current_form_get_handler(), but I really can't see how this ties in with core's entity_language?