Problem/Motivation

Currently the pathauto state table doesn't track the language the state applies to. This is a problem because entities, url-aliases, as well as pathauto patterns can all be language aware, making the pathauto state lacking an essential feature of the parts it connects.
The lack of this information leads to unexpected behaviour and missing features like auto alias configuration per language.

Proposed resolution

Make pathauto_state language aware by adding a language row.
Integrate with Entity Translation by supporting the detection of the active entity language.

Remaining tasks

Reviews needed.
Regression tests necessary.
The form part is a bit cluttered currently because we're not able to get notified about a change in the active language of an entity. Which means we can't update the entity property path['pathauto'] right away. We should consider to propose a new hook in Entity Translation that allows to subscribe to changes of the active entity language.

User interface changes

None.

API changes

New function argument $language for pathauto_entity_state_load() and pathauto_entity_state_load_multiple(). Should be backward compatible as it is an optional argument.

Data model changes

New row in pathauto_state: language
New compound primary key in pathauto_state: entity_type, entity_id, language

Original Report by sergei_brill

I use Entity Translation to translate content to chinese. Some content have custom URL aliases. But when user creates translation, checkbox Generate automatic URL alias is enabled. And the state of checkbox is going to be written in pathauto_state after translation will be saved. When user goes to edit original content, the checkbox is enabled, and pathauto generates automatic URL alias and override custom alias. So, it is impossible to have custom alias for original content and automatic alias for translations (or vice versa).
It would be nice to store language in pathauto_state table.

There is many issues related to similar problem, but I'm not sure they are same.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sergei_brill created an issue. See original summary.

das-peter’s picture

Version: 7.x-1.3 » 7.x-1.x-dev
Issue summary: View changes
Status: Active » Needs review
FileSize
10.53 KB

I totally agree with @sergei_brill
Created patch for this.
Updated issue summary to reflect the state of the attached patch.

das-peter’s picture

Added new linked issue #2741407

das-peter’s picture