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.
We had the issue that entity translation nodes were not redirected correctly when the option Language Path Checking was enabled in Global Redirect.
Therefore I have created a patch which I want to provide you here.
Comment | File | Size | Author |
---|---|---|---|
#16 | globalredirect-entity-translation-language-path-1976320-16.patch | 1.42 KB | betoscopio |
| |||
#10 | globalredirect-1976320-10.patch | 1.42 KB | goron |
#1 | globalredirect-1976320-1.patch | 1.93 KB | Cyclodex |
Comments
Comment #1
Cyclodex CreditAttribution: Cyclodex commentedProviding here the patch to the latest dev version.
Would be great to hear some feedback so please test and review!
This Patch is sponsored by Nothing Interactive.
Comment #2
fuse CreditAttribution: fuse commentedGreat patch. Tried it out and seems to be working.
Comment #3
nevergone CreditAttribution: nevergone commentedI tested and works well!
Comment #4
Cyclodex CreditAttribution: Cyclodex commentedHowdy!
Can this patch get into next release as it seems to work for the people?
Would be great, thanks!
Comment #5
anouPatch from Cyclodex is just fine and works nicely !
Thanks.
Comment #6
wizonesolutionsCan you add tests to this? Lots of people use the module, and we want to make sure it doesn't break for them.
Ideally you could show us the tests failing without the patch and then passing (as well as all the other existing ones, etc.) with it.
Comment #7
Cyclodex CreditAttribution: Cyclodex commentedHey
Ok, I totally understand this. I am not yet used to the tests.
I will try to look into it, anyone else willing to help with this?
Perhaps I will have next week some time for doing this.
Comment #8
kitikonti CreditAttribution: kitikonti commentedHi, i have the same problem, but have not tried the patch now. Bevore i try the patch and maybe try adding some testing, i wantet ask if the "Language Path Checking" option makes any sence if we use entity translation?
Anyway there could still be the setup where a site uses both translation technics.
Comment #9
goron CreditAttribution: goron commentedI don't have time to write tests for this right now, but I just wanted to comment that it does seem to work.
@kitiknti, yeah, I'm keeping it because I need both translation options available.
Comment #10
goron CreditAttribution: goron commentedI'm actually including a new patch for this, because I had a few problems with the last patch:
- The new function's name (_globalredirect_translation_supported_type) and comment were confusing, even if consistent with names from other translation modules. I renamed the function and changed the doc to explain better what the function is doing. Also changed the other comment to be a bit more concise.
- Switched it to use the function that comes with entity_translation for detecting whether it's enabled for the node type, instead of duplicating the logic here.
- Moved the helper function down to the bottom of the file. Probably shouldn't be up there with hook_init and hook_help.
Still needs tests, which I don't have time to add at this point.
Comment #11
gge CreditAttribution: gge commentedJust testes #10 and the nodes are now redirected properly. Before applying this patch, I only had problems with nodes translated by TMGMT module.
Comment #12
jcnventura CreditAttribution: jcnventura commentedComment #13
darby3 CreditAttribution: darby3 commentedDoes this patch only work if you're also using content/node translation? A bit out of my depth but I think that's what I'm seeing. Can it/could it be used for solely entity-translation driven sites?
Comment #14
sokru CreditAttribution: sokru at Druid commented#10 worked fine on my content translation + entity-translation combo. +1 for writing tests also.
Comment #15
cbrody CreditAttribution: cbrody commentedUsing entity_translation, the globalredirect module, whether patched or not, does not redirect to the default language path (i.e. with no language prefix) when no translations exist for a node. Menu and home page links are not redirected either. Where should I look for a fix for this issue?
Comment #16
betoscopioPatch #10 worked well for me with some hunks when applied. Here is a reroll for the current dev.
Comment #17
betoscopioAfter some testing, and trying both versions of the patch I realized that it fix the problem with translated nodes, but while doing this, also the option Language Path Checking stops to work. So, in practice the effect is the same than disable the option.