On path_nodeapi('update') reuse the current path alias language, don't override it with the node content language.
Other modules may have changed the path alias language, for example to enable the alias for all defined languages.

I need this because I use the patch in #321848: How to make pathalias enable alias for all languages? with pathauto, which enables the aliases for all defined languages by removing the language alltogether, but path_nodeapi is resetting the language to the node content one at every node update.

At first I thought the problem was in my patch or in pathauto, but then I traced the probem to path_nodeapi('update') which is called before the pathauto_nodeapi('update') every time and overrides what the latter did on node creation.

Regards,
Antonio

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ao2’s picture

Version: 6.13 » 6.15
Status: Needs work » Needs review

Ping.

I have been using this for months. Am I the only one who needs that the alias language is preserved on update?

Any suggestion about a better way to fix this?

Thanks,
Antonio

gagarine’s picture

Robin van Emden’s picture

Version: 6.15 » 6.16
Status: Needs review » Reviewed & tested by the community

Most certainly not alone. See also #321848: How to make pathalias enable alias for all languages?. The failure of path to preserve language in aliases is a major headache. This patch is sorely needed. Patch reviewed and tested, works in 6.16.

Gábor Hojtsy’s picture

Version: 6.16 » 7.x-dev
Category: support » bug
Status: Reviewed & tested by the community » Patch (to be ported)

Fixes are first committed to Drupal 7, so let's ensure we have a fix there first or that it does not apply there.

klonos’s picture

thanx ao2. works great!

pfx’s picture

Ok ao2,
This pacth what works fine in conjunction with the pacth (#321848: How to make pathalias enable alias for all languages?) with which it is necessary.
big thanks

[ Note I had to manually apply this patch to drupal 6.16:
pfx@pfx-laptop:~/drupal-6/modules/path$ patch -p0 < path_nodeapi_update_dont_override_current_language-d6.patch
patching file modules/path/path.module
Hunk #1 FAILED at 162.
1 out of 1 hunk FAILED -- saving rejects to file modules/path/path.module.rej ]

marvil07’s picture

subscribing

das-peter’s picture

subscribing

GoofyX’s picture

Subscribing...

Dries’s picture

Status: Patch (to be ported) » Needs review

Patch has tabs.

marvil07’s picture

Here the patch for D7, but now that related patch on pathauto #321848: How to make pathalias enable alias for all languages? is marked as won't fix, I am not sure if we want this.

IMHO the problem is:

- If we decide to apply the patch, we end up making impossible to change the path language on update, that means that if a user change the language of a node, the path associated is not changing neither; and that means a broken alias for that node until the language is chnaged again to the original one.
- If we decide to not adding this, that I am not inclining to think that is not a bug, we can not support the workflow as required for making one URL for all languages in pathauto.

So, I would suggest to mark this as won't fix, and for the pathauto problem we should think in other way :-/

PS: I'm not changing status to get some feedback.

klonos’s picture

...now that related patch on pathauto #321848: How to make pathalias enable alias for all languages? is marked as won't fix, I am not sure if we want this.

I know that according to this decision/announcement the pathauto team rejected the idea of #321848: How to make pathalias enable alias for all languages?, but -as Dave has pointed- this is only because the feature is not in the module's scope. This doesn't mean that it is not a valid feature request that is required in order to solve a very crucial issue that people with multilanguage sites face though. It might be done in a submodule or a different project, but whatever is chosen surely needs the grounds for achieving the goal. So, this definitely needs to be implemented in core.

If we decide to apply the patch, we end up making impossible to change the path language on update... If we decide to not adding this... we can not support the workflow as required for making one URL for all languages in pathauto

I hear you on this one Marco. I completely understand your concern, but I believe that the (sub)module that will bring #321848: How to make pathalias enable alias for all languages? to life will somehow be able to have a mechanism to allow/control this behavior through a setting (some 'Allow same alias for all languages' checkbox). Perhaps this could be a per-content type or a global site-wide setting. Now, as for this:

...that means a broken alias for that node until the language is changed again to the original one...

...the title of this issue says 'Let path_nodeapi reuse...' not 'Force path_nodeapi reuse...', so I guess that the goal here is to allow a different behavior without breaking things from how they used to work. Perhaps the patch in its current implementation doesn't do that, but we are in the right path. We have the 'old' way working (without the patch here) and we did figure a way to successfully 'override' that behavior. Now we need to get them to work together/in parallel. I am not saying this is a walk in the park. I understand that *a lot* of work will be required for this to finally be implemented in the proper way, but in the end we'll have a solution. I am confident.

ao2’s picture

@marvil07, thanks for porting the change to D7, I haven't had a chance to took at it yet.

And your observation about a node changing language is a good one, I didn't consider that because it is a rare event, but it can still happen, so we'd better support that.

Maybe we could just check when the alias is enabled for "All languages" and keep it it that way for this case only, continuing to update the alias language to the node language for actual alias languages.

Something like (not tested, just for illustration):

$path['language'] = isset($node->language) && ($path['language'] != LANGUAGE_NONE) ? $node->language : LANGUAGE_NONE;

But I have to think that a little more.

About the won't fix mark in pathauto, well, I think we should try to convince pathauto maintainers to revert it, that task really belongs to pathauto IMHO.

Regards,
Antonio

ao2’s picture

Issue summary: View changes
Status: Needs review » Closed (won't fix)

Closing as "won't fix".

For the use case of having language neutral paths in D7, use the Neutral paths module.