AfterDataGeneratedForWorkspaceEvent 

The PSR-14 event \TYPO3\CMS\Workspaces\Event\AfterDataGeneratedForWorkspaceEvent is used in the Content > Workspaces module to find all data of versions of a workspace.

The event holds one entry per version record, indexed by table name and uid, for example tt_content:42. A listener can add columns to the record table of the module and change the action buttons of a record.

Add a column to the workspaces module with additional 

Changed in version 14.3 Important: #110591 - Custom columns in the workspaces module

Before, the module discarded the additional section and rendered a fixed set of columns.

Add an additional section to a record to add a column. A column is displayed as soon as one record of the workspace declares it, also when that record is on another page of the table.

EXT:my_extension/Classes/Workspaces/EventListener/AddDeadlineColumnListener.php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\Workspaces\EventListener;

use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Workspaces\Event\AfterDataGeneratedForWorkspaceEvent;

#[AsEventListener(
  identifier: 'my-extension/workspaces/add-deadline-column',
)]
final readonly class AddDeadlineColumnListener
{
  public function __invoke(AfterDataGeneratedForWorkspaceEvent $event): void
  {
    $data = $event->getData();
    foreach ($data as $identifier => $record) {
      if ($record['table'] !== 'tt_content') {
        continue;
      }
      $data[$identifier]['additional']['deadline'] = [
        'label' => 'Deadline',
        'value' => '2026-03-01 08:00',
        'icon' => 'actions-clock',
        'title' => 'Editorial deadline',
      ];
    }
    $event->setData($data);
  }
}
Copied!

All keys of a column are optional:

label
Header of the column. Falls back to the column identifier.
value
Content of the cell, rendered as plain text.
icon
Identifier of an icon rendered in front of the value.
title
Title attribute of the cell.
url
Links the content of the cell to this URL.

Change the action buttons of a record with actions 

Changed in version 14.3 Important: #94407 - Custom actions in the workspaces module

Before, the module rendered a fixed set of action buttons, and a listener could not change them.

Add an actions section to a record to change its action buttons. The module merges the section into the actions it determines itself, so give only the keys that differ.

EXT:my_extension/Classes/Workspaces/EventListener/ModifyRecordActionsListener.php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\Workspaces\EventListener;

use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Workspaces\Event\AfterDataGeneratedForWorkspaceEvent;

#[AsEventListener(
  identifier: 'my-extension/workspaces/modify-record-actions',
)]
final readonly class ModifyRecordActionsListener
{
  public function __invoke(AfterDataGeneratedForWorkspaceEvent $event): void
  {
    $data = $event->getData();
    foreach ($data as $identifier => $record) {
      if ($record['table'] !== 'tt_content') {
        continue;
      }
      $data[$identifier]['actions'] = [
        // Render the publish button greyed out
        'publish' => ['enabled' => false],
        // Remove the discard button
        'remove' => ['visible' => false],
        // Add a button of your own
        'schedule' => [
          'icon' => 'actions-clock',
          'title' => 'Schedule publication',
        ],
      ];
    }
    $event->setData($data);
  }
}
Copied!

The module renders the actions preview, qrcode, open, version, expand, changes, publish, and remove itself. An action takes these keys:

enabled
false renders the button greyed out.
visible
false removes the button.
icon
Identifier of the icon of the button.
title
Title attribute of the button.
url
Renders the action as a link to this URL.
group
Identifier of the button group. Actions that the module does not know are in the group custom.

An action of your own without a url renders as a button with a data-action attribute that holds the action identifier. The module renders the record table again on every update, so attach the JavaScript of your extension with event delegation.

The permissions of a record, such as allowedAction_publish, still set the default state of the actions of the module.

API 

final class AfterDataGeneratedForWorkspaceEvent
Fully qualified name
\TYPO3\CMS\Workspaces\Event\AfterDataGeneratedForWorkspaceEvent

Used in the workspaces module to find all data of versions of a workspace.

getGridService()
Returns
\TYPO3\CMS\Workspaces\Service\GridDataService
getData()
Returns
array
setData(array $data)
param $data

the data

getVersions()
Returns
array
setVersions(array $versions)
param $versions

the versions