I write my setup:
Node page settings, in the book field (for every book) I have:
b/[bookpath-raw]/[title-raw]
Then I create a book with some child book pages in english for example and the alias is created correctly. For example:
example.com/b/mybook/introduction (where my book is the first page of the book, and introduction is the child)
Now, I translate the content to spanish, so I get the following path:
example.com/es/b/milibro/introduccion (where milibro and introduccion are the translated page of mybook, and introduction respectively)
Everything fine until I recheck the paths for the english version, and those are changed to:
example.com/b/introduction (without "mybook" in the path)
And the same for all the childs, etc.
If I edit the english page the it recreates the correct path again, but then the spanish path version is modified to
example.com/es/introduccion (without "milibro" in the path)
Using i18n module and pathauto
Thanks for the help.
Comment | File | Size | Author |
---|---|---|---|
#9 | menu.inc_.patch | 576 bytes | claudiu.cristea |
Comments
Comment #1
davebv CreditAttribution: davebv commentednobody? is there any other related post to this?
Comment #2
gregglesSorry. I don't use the i18n module and I don't have any ideas, so I can' t help with this.
Maybe Freso can, but I don't think he uses i18n either.
Comment #3
Freso CreditAttribution: Freso commentedThis sounds rather weird. What other (node) alias patterns have you set up?
Comment #4
davebv CreditAttribution: davebv commentedI have:
default node path pattern
c/[title-raw]
default path pattern for blog post
blog/[title-raw]
default path pattern for book pages (also for neutral, english and spanish languages, all the same)
b/[bookpath-raw]/[title-raw]
default path for Page nodes
p/[title-raw]
For Taxonomy I have the following:
default path pattern:
category/[vocab-raw]/[catpath-raw]
for Blog Tags vocabulary:
blog/[vocab-raw]/[catpath-raw]
Do you see anything weird? or bad configured?
Comment #5
gregglesComment #6
davebv CreditAttribution: davebv commented(sorry for having changed the component, I did not realised)
Comment #7
claudiu.cristeaIt seems that this occur when i18n synchronize translations...
Comment #8
claudiu.cristeaAfter making some investigations I found the following:
i18nsync_node_translation()
from modulei18nsync
(from i18n) saves also the translated nodes, usingnode_save()
.node_save()
is applied on the translated nodes, he ask all modules to act on the node update. And so Pathauto module is recreating the paths for the translated nodes.node_token_values()
andbook_token_values()
fromtoken_node.inc
, the Token module is calling for_menu_titles()
to get the trail to the current book page (or the menu trail for the current node)._menu_titles()
uses themenu_tree_all_data()
function to obtain the hierarchy data for books and/or menus.menu_tree_all_data()
is returning no data when is called second time in the same request. And so_menu_titles()
is returning an empty array that causes empty paths for[bookpath-raw]
,[bookpath]
,[menupath-raw]
and[menupath]
tokens for the second and next nodes saves in the same request.Affected tokens:
[bookpath-raw]
[bookpath]
[menupath-raw]
[menupath]
Related issues
Actions taken:
Comment #9
claudiu.cristeaDigging more, I found that this is fired up by a line in menu.inc Drupal core file. In line ~970, function menu_tree_collect_node_links() we have:
You can see there that the access of the menu item (
$tree[$key]['link']['access']
) is set to FALSE. This is causing menu_tree_check_access() [called from menu_tree_all_data()] to exclude the item for menu trail.It would have been desirable that function menu_tree_check_access() to set the proper access value... but it doesn't.
I hacked the Drupal file menu.inc as in the attached patch and now the paths are built fine on my site...
If you want to use the patch keep in mind that this patch is a Drupal core patch and can break other things on Drupal. Some testing and inputs can be valuable... Maybe some guys that designed the new Menu system can explain more here...
Comment #10
humble.techy CreditAttribution: humble.techy commentedIs this related ? #242601: translate node references with i18nsync The patch is for 5.x
Comment #11
humble.techy CreditAttribution: humble.techy commentedI disabled the synchronization for now to not to update the translated content.
Comment #12
Panchobook CreditAttribution: Panchobook commentedIn my experience of this bug, with any synchronization the url aliases to the translated nodes (not the one being saved) get completely wiped out, not only modified, as davebv reported.
Did as humble.techy and disabled all synch. Pathauto works fine then.
Comment #13
claudiu.cristeaI'm almost sure that this bug is caused because the items of the menu system that are in other language than the current language have the
access
property set toFALSE
. This mean that wheni18nsync
tries to recompute the paths for the non-current-language menu items he cannot access them for read. This is causing the failure of getting the trail for the non-current-language menu items. This a by design issue.My opinion is that this is a wrong approach to hide non-current-language menu items. The multilanguage system MUST NOT use
access
flag to hide those menu items. If they are in other language this DOESN'T MEAN that the user is denied to access them. It only means that they are hidden to user. A new flag must be used to hide other language menu/book items. Maybe something likehidden
.We need a qualified input here from developers of menu system and of the i18n on this issue!
Comment #14
claudiu.cristeaMoved the issue to Internationalization module while is related to translated menu items and i18nsync.
Comment #15
Jose Reyero CreditAttribution: Jose Reyero commentedIt seems this issue has moved around a lot of modules. And while it's a side effect of how they all work, it's not really a bug on any of them
@claudiu,
I think you've made a great analysis of this issue in #8 and #13
I completely agree about the menu system issues.
As patching D6 core is not really an option and there's very little we can do on i18nsync alone, I think the better solution would be either:
- Not doing any path aliasing that depends on the page context (I can imagine this will fail too with any other module using node_load / node_save in a different page than node/x/edit.)
- Implementing some way to skip recalculating path aliases on node update. Though this may be an issue too because these paths may may actually need to be recalculated based on the updates done by i18nsync (tags, etc...)
Ideally, doing a node_save(node_load(nid)) should never change a node... Could this be a feature request for pathauto? If you find other contrib modules doing node updates using the api, maybe...
Btw, if someone wants to do some more research, what happens when you update several nodes at once using the content administration pages? does pathauto works fine on this case with such tokens?
Comment #16
ao2 CreditAttribution: ao2 commented@claudiu.cristea: isn't there a typo
s/return/result/
in the patch posted in comment #9 ?BTW, I also have this one triggered by pathauto with alias pattern for pages set to
[manupath-raw]
.I am sure your patch will work ok, but I read here this can be worked around also disabling i18nsync, well, I have it disabled in the module list, but the issue is still here, any more steps? Or patching core is the only viable option for now?
Thanks,
Antonio
Comment #17
claudiu.cristeaPlease do not use that patch... It's not solving the issue
Comment #18
claudiu.cristea@Jose,
Don't you think that this must be addressed now in D7 branch? As I mentioned and you agreed "non current language menu items" are hidden now based on the
access
. This flag is set toFALSE
for those menu items. Being in other language doesn't mean unaccessible, it just mean hidden. If we want to access them, we cannot... And, yes, we surely want at least in i18n_sync module.For this reason I think that we have to contact the menu system developers and fire up this issue and fix this in Drupal 7. My approach it would be to add an additional field (flag) to menu items, something like
visible
(boolean) that can be used by modules like i18n to hide menu items... (and not to make them inaccessible).Any thoughts?
Comment #19
claudiu.cristeaChanged also the status.
Comment #20
rolfmeijer CreditAttribution: rolfmeijer commentedsubscribing
Comment #21
TripleEmcoder CreditAttribution: TripleEmcoder commentedSubscribing.
Comment #22
colanSubscribing.
Comment #23
joseph.olstadAppears to be a 6.x issue.
Closing;
Please see :
#1303518: Clean up the issue tracker. Close old issues without follow up.