Pathauto 1.3 merged the pathauto_persist module which creates a pathauto_state table to store it's setting for each node (see https://www.drupal.org/node/936222). The setting is loaded with pathauto's hook_entity_load(). But entity_translation ignores this and forces new translations of a node to always have pathauto switched on.
Scenario
In a site with two languages, English and French, a user creates a page in English and turns pathauto off so they can type a custom path. After saving it, they go to add a French translation of the same page...
Expected Behaviour
Pathauto should be turned off.
Actual Behaviour
Pathauto is turned on again, even though they turned it off when they created the English translation.
This patch just removes the bit that overrides pathauto. Also, see my other issue & patch regarding pathauto https://www.drupal.org/node/2743685
I'm using Drupal 7.43, Entity translation 7.x-1.x-dev (May 29, 2016), Pathauto 1.3
Comment | File | Size | Author |
---|---|---|---|
#6 | entity_translation-respect_pathauto_state-2741407-6.patch | 756 bytes | bwaindwain |
#2 | entity_translation-respect_pathauto_state-2741407-2.patch | 756 bytes | bwaindwain |
Comments
Comment #2
bwaindwain CreditAttribution: bwaindwain as a volunteer commentedComment #3
bwaindwain CreditAttribution: bwaindwain as a volunteer commentedComment #5
bwaindwain CreditAttribution: bwaindwain as a volunteer commentedComment #6
bwaindwain CreditAttribution: bwaindwain as a volunteer commentedsame patch re-posted to go through testing properly
Comment #7
bwaindwain CreditAttribution: bwaindwain as a volunteer commentedComment #8
bwaindwain CreditAttribution: bwaindwain as a volunteer commentedComment #9
NitebreedI supposed it was possible to have different pathauto settings for lets say an English node and it's French translation (automatic or not), but as I see this isn't the case as the pathauto setting is unique on the node (not unique per language).
In this light, the patch does the right job.
Comment #10
joseph.olstadis reasonable expected behavior , thanks.
Comment #11
stefanos.petrakis@gmail.comI don't think this should be changed.
The current code's comment says:
This is UX-related logic, and the problem it's trying to solve it the generation of URLs (path)automatically,
without the user having to go through the vertical tabs in order to locate and check the
Generate automatic URL alias
checkbox.As it is now:
a) Entities without a URL alias, will get one from pathauto, only if they don't have one, without the user having to do anything
b) On subsequent loading of the form, during edits, the checkbox is unchecked, since there is a URL alias already there. The user is then free to overwrite the pathauto generated alias.
If we go with the suggested code change, when adding a translation, the user always has to go and enter a URL alias, otherwise the translation will not get one. The UX-overhead of unchecking the checkbox is minimal, in comparison to always having to locate the vertical tabs and check that same checkbox.
I am setting this to works-as-designed and will be happy to get some counter-argumentation in case I missed sth important.
Comment #12
bwaindwain CreditAttribution: bwaindwain as a volunteer commentedGood points.
I like you're idea of letting pathauto make urls for new translations.
But... if we go with the suggested patch, the user isn't forced to enter a URL alias when adding a translation. They'll end up with something like /fr/node/123 which will work fine. And, pathauto will be unchecked which is predictable and consistent, which I think makes for good UX.
Hmmm, now I'm undecided.
Comment #13
stefanos.petrakis@gmail.comI see your point too; it seems to me that both cases deserve to be backed up by the implementation.
So, instead of removing the existing logic as suggested in the original patch, I think we should look for a way to extend it or parametrize it in order to be able to cover the case you are describing.
For example:
And that would allow covering both cases via configuration.
Thoughts?
Comment #14
joseph.olstadI agree, sounds like a good plan
Comment #15
stefanos.petrakis@gmail.comThis can now be handled via configuration, a patch is available over at #3010146: Expose extended ET-specific configuration for pathauto that needs reviewing.
If that goes through, this can be closed as a "Won't fix" since it will then be possible to toggle the pathauto_state default for new translations.
Comment #16
stefanos.petrakis@gmail.comAs mentioned before, this is now configurable, for more information, see #3010146: Expose extended ET-specific configuration for pathauto
Comment #17
joseph.olstadnice work Stefanos, thanks!