Provide diff tokens for nodes

Created on 6 April 2023, about 1 year ago
Updated 20 June 2024, 7 days ago

Problem/Motivation

The Drupal 7 version of this module did provide a number of tokens for nodes to show differences between revisions. Let's add those tokens to the Drupal 9/10 version.

Possible use cases include providing a preview of the changes in notification mails to reviewers for content moderation state changes or with contributed modules like ECA β†’ to execute actions based on the contents of diffs.

Proposed resolution

Provide tokens that will show differences between revisions in the configured default diff layout:

  1. [node:diff]: The differences between the current revision and the latest revision of a node.
  2. [node:diff-previous-latest]: The differences between the previous (before latest) revision and the latest revision of this node.
  3. [node:diff-current]: The differences between the current revision and the actual revision of this node.
  4. [node:diff-latest]: The differences between the actual revision and the latest revision of this node.
  5. [node:diff-previous]: The differences between the previous (before actual) revision and the actual revision of this node.
✨ Feature request
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany FeyP

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @FeyP
  • πŸ‡©πŸ‡ͺGermany FeyP

    Attached is a patch against 8.x-1.x-dev.

  • Issue was unassigned.
  • Status changed to Needs review about 1 year ago
  • πŸ‡©πŸ‡ͺGermany FeyP

    Found an issue with the bubbling of cache metadata, so new patch and interdiff attached. Also updated the tests to assert correct metadata.

    Like the previous patch, this requires PHP 7.4 or later, but I think this is just due to some of the type hinting. Looks like the default testing is currently for PHP 7.3. If needed, I can probably provide an updated patch that is compatible with 7.3 as well. Let me know.

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update about 1 year ago
    39 pass, 1 fail
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update about 1 year ago
    40 pass
  • πŸ‡¬πŸ‡§United Kingdom jaydenpearly

    Thanks @FeyP ...
    #3 - 3352640-03.patch is working.

    Tested versions
    Drupal: 10.2.7
    diff: 1.7
    token: 1.14
    php: 8.3

    +1 for RTBC

Production build 0.69.0 2024