Problem/Motivation
On the edition page for a node revision, using Entity Translation for node translation, there is no language switcher (in the secondary tabs) like in the node edit page.
Requirement
Entity Translation (using 7.x-1.0-beta4) enable and a content-type using both ET and State Flow.
Language detection using URL method (prefix) for content-type, and all site languages (at least 2) must have a prefix define.
At least one field in the content-type must be translatable.
(Optional)
In my case I have enabled the Title module and replace the content-type title by a field title. The field translation was activated.
Steps to reproduce
- Create a content in English, and save "to draft" (e.g. with content-type Basic page).
- Add a translation in French and keep it at draft state. (ET language switcher exist)
- Update the French translation and publish the content. (ET language switcher exist)
- Again update the French translation and set its status to draft. (ET language switcher exist)
- Once again update the French translation. This time the ET language switcher will not appear.
Proposed resolution
TL;DR: Add Entity Translation language switcher to node revision edit page.
The issue appear because the page callback of the path 'node/%node/edit' was alterated. It's important to preserve the concept add with this alteration: user always edit the active revision of a node.
The workaround I propose start with removing this alteration. Preciselly, I moves its concept in a hook_inbound_url_alter.
This way the node page handle node content only and node revision page handle node revision content (beside the url path looking like node page).
For now I just moves some code and change some process a little bit. But my main purpose was to add language switcher.
To do so, I create an Entity Translation handler dedicated to node revision. Using the custom page create by State Flow module to edit node revision.
But, yes there is a but...
Remaining tasks
On the node revision edit page, there is no primary tabulations. See the issue 1493638 and comment #5.
If you find these feature request interesting, I will gladly pursue my effort.
Finally, big thanks for the module and the great work on the 3.x version.
Comments
Comment #2
anfor commentedComment #3
anfor commentedComment #4
anfor commentedUpdate the patch with the latest dev version and fix an issue in the hook_url_inbound_alter (regarding the fourth argument in node edit page).
Comment #5
anfor commentedUsing sun advice in the related issue 1493638, I make a quick patch (need this other patch to work).
So far, I did not encounter any error.
Comment #6
anfor commentedComment #8
das-peter commented@anfor Thank you very much for working on this! Your approach and references where a great help.
As I didn't like the
hook_url_inbound_alter()approach I investigated a little bit further and was able to come up with a solution that works without that. However, it relies on this entity_translation patch: #1707156: Workbench Moderation integrationMy approach is to register a dedicated entity translation
path schemein the entity info to support the revision handling.I added a custom EntityTranslationHandler class too - but its sole purpose is to make sure that when we're in the
state_flowpath scheme the requested and not the active revision is used. That way we're compatible with the general entity_translation integration mentioned above.I also gave the menu items the appropriate type as outlined in the issue you referenced: #1493638: Make node/%node/revisions/%/edit a local task so that you don't lose the tab navigation when editing a revision
The approach should be pretty much backward compatible - without patch #1707156: Workbench Moderation integration everything will run normal.
I've attached the changes I've already pushed as patch too.
Now we should make sure that the entity translation patch lands as soon as possible: #1707156: Workbench Moderation integration
Comment #9
das-peter commentedLooks like #1707156: Workbench Moderation integration actually was the cause for the need of our own entity translation handler.
Without this patch everything seems to work out of the box :)