Issue

The Revisioning module lets you create multiple revisions of a node and keep newer revisions in "moderation" until they're ready to be published. Most fields display the correct revision, but the Title module always show the latest revision.

Steps to reproduce

1. Install dev versions of Title and Revisioning.
2. Enable Title replacement for a node type, preferably one that has a body field.
3. Open a node form of that type and enter the following values: Title = "First title", Body = "First body"
4. Leave the revision information set as "Create new revision, no moderation".
5. Save.
6. Edit the node values to be: Title = "Second title", Body = "Second body".
7. Change the revision information to be "Create new revision and moderate".
8. Save.
9. Visit the "View current" tab.
10. Note that body is "First body" and title is "Second Title".

Both values should be "First ____" since the second revision has not been published.

Comments

milesw’s picture

Status: Active » Needs review
StatusFileSize
new781 bytes

Because of the way core handles field revisions, the revisioning module has to call field_attach_load_revision() directly from within hook_node_load(). This feels like somewhat of a hack, as comments in revisioning_node_load() admit, but apparently that's by design.

The real problem is that the Title module statically caches the first time a title is synced. When Revisioning calls field_attach_load_revision() the Title module thinks it's already synced and does not update with new values.

This patch clears the sync status on hook_field_attach_load().

plach’s picture

Looks nice, thanks. I think the code for clearing static cache can be refactored in a utility function, which can then be called from everywhere we need it.

milesw’s picture

StatusFileSize
new2.01 KB

Good idea.

New patch uses the new function title_entity_sync_static_reset().

plach’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me, thanks.

plach’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed, thanks!

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

Anonymous’s picture

Issue summary: View changes

Formatting

  • Commit 2c11348 on 7.x-1.x, workbench authored by milesw, committed by plach:
    Issue #1991712 by milesw: Fixed Title displays wrong revision using...