---
title: "Feature: #97450 - PSR-14 event for modifying version differences"
manual: "TYPO3 Core Changelog"
version: "main"
permalink: "https://docs.typo3.org/permalink/changelog:feature-97450"
source: "Changelog/12.0/Feature-97450-PSR-14EventForModifyingVersionDifferences.rst"
typo3-version: "12.0"
typo3-major: 12
type: "feature"
issue: 97450
forge: "https://forge.typo3.org/issues/97450"
tags: ["Backend", "PHP-API", "ext:backend"]
rendered: "2026-09-20T18:31:11+00:00"
---

# Feature: #97450 - PSR-14 event for modifying version differences {#feature-97450}

See [forge#97450](https://forge.typo3.org/issues/97450)

## Description {#description}

A new PSR-14 event `\TYPO3\CMS\Workspaces\Event\ModifyVersionDifferencesEvent`
has been introduced which serves as a direct replacement for the now removed
`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['workspaces']['modifyDifferenceArray']`
[hook](https://docs.typo3.org/permalink/changelog:breaking-97450).

It can be used to modify the version differences data, used for the display
in the **Workspaces** backend module. Those data can be accessed with
the `getVersionDifferences()` method, and updated using
the `setVersionDifferences(array $versionDifferences)` method.

The version differences `array` contains the differences of each field,
with the following keys:

-   `field`: The corresponding field name,
-   `label`: The corresponding fields' label,
-   `content`: The field values difference

Furthermore does the event provide the following methods

-   `getLiveRecordData()`: Returns the records live data (used to create the version difference)
-   `getParameters()`: Returns meta information like current stage and current workspace

> [!NOTE]
> The removed hook allowed to update the live record data. This however had
> no effect since those data are not further used by TYPO3. Therefore, the
> new event does no longer provide a setter for the live record data.

> [!NOTE]
> The removed hook contained an instance of `DiffUtility`, which can
> be used to generate the differences `string`. Since PSR-14 events
> are usually pure data objects, without dependencies to any service, the
> new PSR-14 event does no longer provide an instance of `DiffUtility`.
> Listeners have to inject the service on their own - if needed.

## Example {#example}

Registration of the event in your extension's `Services.yaml`:

```yaml
MyVendor\MyPackage\Workspaces\MyEventListener:
  tags:
    - name: event.listener
      identifier: 'my-package/workspaces/modify-version-differences'
```

The corresponding event listener class:

```php
use TYPO3\CMS\Core\Utility\DiffUtility;
use TYPO3\CMS\Workspaces\Event\ModifyVersionDifferencesEvent;

final class MyEventListener
{
    public function __construct(protected readonly DiffUtility $diffUtility)
    {
        $this->diffUtility->stripTags = false;
    }

    public function __invoke(ModifyVersionDifferencesEvent $event): void
    {
        $differences = $event->getVersionDifferences();
        foreach($differences as $key => $difference) {
            if ($difference['field'] === 'my_test_field') {
                $differences[$key]['content'] = $this->diffUtility->makeDiffDisplay('a', 'b');
            }
        }

        $event->setVersionDifferences($differences);
    }
}
```

## Impact {#impact}

It's now possible to modify the version differences of a versioned record,
using the new PSR-14 event `ModifyVersionDifferencesEvent`.
