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

  1. Create a content in English, and save "to draft" (e.g. with content-type Basic page).
  2. Add a translation in French and keep it at draft state. (ET language switcher exist)
  3. Update the French translation and publish the content. (ET language switcher exist)
  4. Again update the French translation and set its status to draft. (ET language switcher exist)
  5. 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

anfor created an issue. See original summary.

anfor’s picture

anfor’s picture

Status: Active » Needs review
anfor’s picture

Title: Node revision edit page with Entity Translation » Edition of a node revision with Entity Translation language switcher
StatusFileSize
new5.59 KB

Update 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).

anfor’s picture

Using 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.

anfor’s picture

Issue summary: View changes

  • das-peter committed 1b62208 on 7.x-3.x
    Issue #2546728 by anfor, shawn_smiley, sun, das-peter: Edition of a node...
das-peter’s picture

Status: Needs review » Fixed
Related issues: +#1707156: Workbench Moderation integration
StatusFileSize
new4.62 KB

@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 integration
My approach is to register a dedicated entity translation path scheme in 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_flow path 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

das-peter’s picture

Looks 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 :)

  • das-peter committed b15a519 on 7.x-3.x
    Issue #2546728 by anfor, das-peter: Edition of a node revision with...

Status: Fixed » Closed (fixed)

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