---
title: "Feature: Introduce PluginControllerActionContextInterface and PluginControllerActionContext"
manual: "Academic Base"
version: "main"
permalink: "https://docs.typo3.org/permalink/fgtclb/academic-base:feature-1758794400@main"
source: "Changelog/2.1/Feature-FeatureIntroducePluginControllerActionContextInterfaceAndPluginControllerActionContext.rst"
rendered: "2026-10-17T08:47:46+00:00"
---

# Feature: Introduce `PluginControllerActionContextInterface` and `PluginControllerActionContext` {#feature-1758794400}

## Description {#description}

Interface `FGTCLBAcademicBaseDomainModelDtoPluginControllerActionContextInterface`
is introduced to describe a shared DTO container for generic data structures required in
extbase controller action based events. The interface **should** be used for native type
declaration in the event, and either a custom implementation based on the event or default
implementation `FGTCLBAcademicBaseDomainModelDtoPluginControllerActionContext` can
be used to create container when dispatching the events. In most cases provided default
implementation should be enough, and additional data provided directly as event property
and getter/setter.

## Example Usage {#example-usage}

### Custom event {#custom-event}

**EXT:my_ext/Classes/Event/MyCustomControllerActionEvent.php**

```php
<?php

declare(strict_types=1);

namespace MyVendor\MyExt\Event;

use FGTCLB\AcademicBase\Domain\Model\Dto\PluginControllerActionContextInterface;

final class MyCustomControllerActionEvent
{
    public function __construct(
        private readonly PluginControllerActionContextInterface $pluginControllerActionContext,
        // ... additional properties
    ) {}

    public function getPluginControllerActionContext(): PluginControllerActionContextInterface
    {
        return $this->pluginControllerActionContext;
    }
}
```

### Dispatch custom event in a controller providing the context information {#dispatch-custom-event-in-a-controller-providing-the-context-information}

**EXT:my_ext/Classes/Controller/MyController.php**

```php
<?php

 declare(strict_types=1);

 namespace MyVendor\MyExt\Controller;

 use Psr\EventDispatcher\EventDispatcherInterface;
 use Symfony\Contracts\HttpClient\ResponseInterface;
 use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
 use MyVendor\MyExt\Event\MyCustomControllerActionEvent;

 final class MyController extends ActionController
 {
     public function __construct(
         private readonly EventDispatcherInterface $eventDispatcher,
     ) {}

     public function customAction(): ResponseInterface
     {
         // Dispatch custom PSR-14 event having at least the plugin controller
         // action context data attached, allowing to determine the action and
         // plugin data within an event listener avoiding that this has to be
         // loaded manually again.
         $event = $this->eventDispatcher->dispatch(new MyCustomControllerActionEvent(
             pluginControllerActionContext: new PluginControllerActionContext(
                 request: $this->request,
                 settings: $this->settings,
             ),
         ));
     }
 }
```
