I'm using latest DEV from pathauto_i18n with patch for setting the default value for alias creation (https://www.drupal.org/node/2463109).

I use Drupal 7.36 with default language ENGLISH and GERMAN as source language for entity translation. I have Workbench Moderation enabled, which implements a workflow for approving and publishing a node. So If you change a node you create a draft, the draft will be checked and if all is ok it will be published.

I set the default value for my content type to "active", so every time I edit a node the checkbox from pathauto is active and the one from pathauto_i18n too - thats exactly what I want and need.

Now if I edit the German entity and change the title the alias will be updated as expected (title is used for alias creation). I checked the table url_alias for this node - the alias was updated.
Now I switch to the English entity and change the title too, remind both checkboxes are enabled, save the node, but now the table was not updated.

Comments

matroschker’s picture

No update here for this issue?

jbylsma’s picture

Status: Active » Needs review
StatusFileSize
new1.13 KB

I believe I've encountered the same issue. I am testing a site with two languages, English and Spanish. The following reproduces the issue:

  • Set node alias pattern to [node-title]-[node-vid].
  • Create a English node.
  • Create a Spanish translation of node. English alias will be the previous vid.
  • Update the English translation. Both aliases will have the same vid.

The same issue appears if a Spanish node is created and an English translation is created.

The problem comes from the language check in pathauto_i18n_update_alias(). $entity appears to always have the original entity's language in $entity->language. Continuing with the previous example, here is the alias workflow when updating a node with the original language English and a Spanish translation.

  • Updating English (original language) node
    • pathauto_i18n_update_alias(): Spanish (translation) alias updated
    • pathauto_node_update_alias(): English (original language) updated
  • Updating Spanish (translation) node
    • pathauto_i18n_update_alias(): Spanish (translation) alias updated. English (original language) alias ignored.
    • pathauto_node_update_alias(): Spanish (translation) alias updated.

Pathauto properly updates the relevant alias by parsing the correct language with pathauto_entity_language(). I've switched the language check in pathauto_i18n_update_alias() to use the same function, which should be OK because pathauto is a dependency of pathauto_i18n. I don't believe this should affect users and taxonomy term aliasing, and both tests passed in my local environment, but I'm not very familiar with Drupal translations. Patch was created against the latest HEAD. Thanks!

matroschker’s picture

Thank you for this patch, it works for me if saving a node in the edit mode.
But if I want to generate the URL alias via VBO or standard function from pathauto - "generate url alias" it does not work. Only the English language (our default language in the system) gets an alias.

jbylsma’s picture

@Matroschker: I am able to delete all aliases and bulk update them using both Pathauto and VBO. I do not have the patch from #2463109: Ability to set the default value of the checkbox per content type applied.

You mentioned using Workbench Moderation, and I wouldn't be surprised if your other issues were coming from there. The current Workbench Moderation release has a major bug with Pathauto which was addressed in dev (#2308095-20: URL alias reverts to Automatic generate alias when published). The Pathauto maintainer also suggests using Pathauto persistent state with Workbench Moderation (#1852244-11: Setting path to default Pathauto value).

Is it possible for you to try the patch in a non-Workbench Moderation environment?

matroschker’s picture

Sorry, for the delay. We are able to "solve" this ;-). Activated the new VBO-actions coming from pathauto_i18n in the view and it is possible to change a lot of nodes in one step.

"Pathauto persistent state" we don't use, because we are using a patched pathauto version which already contains the "Pathauto persistent state" - features, plz refer too https://www.drupal.org/node/936222

Thank you.

jbylsma’s picture

Status: Needs review » Reviewed & tested by the community

Glad to hear it! I'm going to set the status as RTBC, under the assumption you are still using the patch from #2. If that's not correct, please change the status back.

  • sanchiz committed 653dbc6 on 7.x-1.x authored by jbylsma
    Issue #2488244 by jbylsma: Alias not updated for default language
    
sanchiz’s picture

Status: Reviewed & tested by the community » Fixed

Committed.

Thanks so much @jbylsma!

Available now in 7.x-1.x-dev or in in 7.x-1.4 and later once released.

sanchiz’s picture

Issue tags: +CodeSprintUA, +dcuacs2015

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.