---
title: "PSR-14 Events"
manual: "Content Planner"
version: "2.5"
source: "DeveloperCorner/Events.rst"
modified: "2026-09-16T11:40:44+00:00"
---

# PSR-14 Events

**Table of Contents**

-   [PrepareStatusSelectionEvent](#preparestatusselectionevent)
-   [StatusChangeEvent](#statuschangeevent)
-   [CommentCreatedEvent](#commentcreatedevent)
-   [CommentResolvedEvent](#commentresolvedevent)

The extension contains some PSR-14 events which make it possible to extend the extension with own functionality.
You can for example adjust the status selection or react on status changes for implementing some kind of a workflow.

If you are new to PSR-14 events, please refer to the official TYPO3 documentation about
[PSR-14 events and Event Listeners](https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/Events/EventDispatcher/Index.html).

## PrepareStatusSelectionEvent

This event is dispatched before the status selection is rendered. You can use it to modify the available status options.

**Classes/EventListener/ModifyStatusSelectionListener.php**

```php
<?php
namespace MyVendor\MyExtension\EventListener;

use Xima\XimaTypo3ContentPlanner\Event\PrepareStatusSelectionEvent;

final class ModifyStatusSelectionListener
{
    public function __invoke(PrepareStatusSelectionEvent $event): void
    {
        $table = $event->getTable();
        $uid = $event->getUid();
        $selectionEntries = $event->getSelectionEntriesToAdd();

        // Remove a specific status from selection
        unset($selectionEntries['3']);

        $event->setSelectionEntriesToAdd($selectionEntries);
    }
}
```

**Configuration/Services.yaml**

```yaml
MyVendor\MyExtension\EventListener\ModifyStatusSelectionListener:
  tags:
    - name: event.listener
      identifier: 'my-extension/modify-status-selection'
```

## StatusChangeEvent

This event is dispatched after the status of a record has been changed. You can use it to trigger additional actions like notifications or workflow transitions.

Note that `$newStatus` may be `null` when a status is cleared from a record.

**Classes/EventListener/StatusChangeListener.php**

```php
<?php
namespace MyVendor\MyExtension\EventListener;

use Xima\XimaTypo3ContentPlanner\Event\StatusChangeEvent;

final class StatusChangeListener
{
    public function __invoke(StatusChangeEvent $event): void
    {
        $table = $event->getTable();
        $uid = $event->getUid();
        $newStatus = $event->getNewStatus();
        $previousStatus = $event->getPreviousStatus();

        // Example: Send notification when status changes to a specific status (uid 3)
        if ($newStatus?->getUid() === 3) {
            // Trigger notification logic
        }
    }
}
```

**Configuration/Services.yaml**

```yaml
MyVendor\MyExtension\EventListener\StatusChangeListener:
  tags:
    - name: event.listener
      identifier: 'my-extension/status-change'
```

## CommentCreatedEvent

This event is dispatched after a new comment has been saved to the database. This includes both root comments and replies. Use it for notifications, activity logging, or integration with external systems.

The `table` property refers to the record being commented on (e.g. `pages`), not the comment table itself.

**Classes/EventListener/CommentNotificationListener.php**

```php
<?php
namespace MyVendor\MyExtension\EventListener;

use Xima\XimaTypo3ContentPlanner\Event\CommentCreatedEvent;

final class CommentNotificationListener
{
    public function __invoke(CommentCreatedEvent $event): void
    {
        $table = $event->getTable();           // e.g. 'pages'
        $recordUid = $event->getRecordUid();   // UID of the commented record
        $commentUid = $event->getCommentUid(); // UID of the new comment
        $authorUid = $event->getAuthorUid();   // UID of the backend user

        // Example: Send Slack notification
    }
}
```

**Configuration/Services.yaml**

```yaml
MyVendor\MyExtension\EventListener\CommentNotificationListener:
  tags:
    - name: event.listener
      identifier: 'my-extension/comment-notification'
```

## CommentResolvedEvent

This event is dispatched when a comment is marked as resolved. It is **not** dispatched when a comment is reopened (unresolved).

**Classes/EventListener/CommentResolvedListener.php**

```php
<?php
namespace MyVendor\MyExtension\EventListener;

use Xima\XimaTypo3ContentPlanner\Event\CommentResolvedEvent;

final class CommentResolvedListener
{
    public function __invoke(CommentResolvedEvent $event): void
    {
        $table = $event->getTable();               // e.g. 'pages'
        $recordUid = $event->getRecordUid();       // UID of the commented record
        $commentUid = $event->getCommentUid();     // UID of the resolved comment
        $resolvedByUid = $event->getResolvedByUid(); // UID of the resolving user

        // Example: Log resolution for audit trail
    }
}
```

**Configuration/Services.yaml**

```yaml
MyVendor\MyExtension\EventListener\CommentResolvedListener:
  tags:
    - name: event.listener
      identifier: 'my-extension/comment-resolved'
```

> [!NOTE]
> **See also**
>
> View the sources on GitHub:
>
> -   [PrepareStatusSelectionEvent](https://github.com/xima-media/xima-typo3-content-planner/blob/main/Classes/Event/PrepareStatusSelectionEvent.php)
> -   [StatusChangeEvent](https://github.com/xima-media/xima-typo3-content-planner/blob/main/Classes/Event/StatusChangeEvent.php)
> -   [CommentCreatedEvent](https://github.com/xima-media/xima-typo3-content-planner/blob/main/Classes/Event/CommentCreatedEvent.php)
> -   [CommentResolvedEvent](https://github.com/xima-media/xima-typo3-content-planner/blob/main/Classes/Event/CommentResolvedEvent.php)
