---
title: "Events"
manual: "Video VTT"
version: "2.9"
permalink: "https://docs.typo3.org/permalink/traw/video-vtt:configuration@2.9"
source: "Administrator/Events.rst"
rendered: "2026-09-22T15:18:12+00:00"
---

# Events {#configuration}

PSR-14 events available:

**PosterImageCropVariantEvent**
In case the available crop variants for Image reference have been changed in your installation,
this event can be used to change the used crop variant for the video poster image

# PosterImageCropVariantEvent Listener {#posterimagecropvariantevent-listener}

This example demonstrates how to register an event listener that modifies
the crop variant of a poster image.

## Event Listener Class {#event-listener-class}

```php
<?php
declare(strict_types=1);

namespace Vendor\MyExtension\EventListener;

use TRAW\VideoVtt\Events\PosterImageCropVariantEvent;
use TYPO3\CMS\Core\Attribute\AsEventListener;

#[AsEventListener(identifier: 'my-extension/poster-crop-variant')]
class PosterImageCropVariantEventListener
{
    public function __invoke(PosterImageCropVariantEvent $event): void
    {
        $event->setCropVariant('desktop');
    }
}
```

## Explanation {#explanation}

The listener reacts to the `PosterImageCropVariantEvent` and overrides
the crop variant by calling:

```php
$event->setCropVariant('desktop');
```

## Registration {#registration}

The event listener is registered automatically via the PHP attribute:

```php
#[AsEventListener(identifier: 'lin-template/poster-crop-variant')]
```

No additional configuration in `Services.yaml` is required.

## Result {#result}

Whenever the event is dispatched, the crop variant will be set to
`desktop`.
