---
title: "ModifyPluginViewEvent"
manual: "Academic Programs"
version: "main"
permalink: "https://docs.typo3.org/permalink/fgtclb/academic-programs:developers-event-modify-plugin-view-event@main"
source: "Developers/Events/ModifyPluginViewEvent.rst"
rendered: "2026-10-17T08:47:58+00:00"
---

# ModifyPluginViewEvent {#developers-event-modify-plugin-view-event}

`\FGTCLB\AcademicBase\Event\ModifyPluginViewEvent` belongs to
**academic_base**, and the plugins of seven academic extensions
dispatch it. It hands a listener the view of a plugin right before it
renders, so the listener can assign further variables that a template override
renders. The event, its methods and the context it carries are described in
the [documentation of academic_base](https://docs.typo3.org/p/fgtclb/academic-base/main/en-us/Developers/Events/ModifyPluginViewEvent.html#developers-event-modify-plugin-view-event).
This page states what the plugins of **academic_programs** pass in.

## When it is dispatched {#when-it-is-dispatched}

Each of the three content elements dispatches the event once per rendering,
after its action assigned its own variables:

| Content element | `getPluginName()` | `getActionName()` | Dispatched |
| --- | --- | --- | --- |
| **Course List** | `ProgramList` | `list` | after [ModifyProgramListEvent](https://docs.typo3.org/permalink/fgtclb/academic-programs:developers-event-modify-program-list-event@main) and the seven variables of the list |
| **Course Finder** | `ProgramFinder` | `finder` | after [ModifyProgramListEvent](https://docs.typo3.org/permalink/fgtclb/academic-programs:developers-event-modify-program-list-event@main) and the seven variables of the finder |
| **Course Data** | `ProgramDetails` | `show` | after the variables of the details |

`getControllerExtensionName()` returns `AcademicPrograms` for all three.
A submission of the filter form of the list is answered with a redirect and
renders nothing, so it dispatches no event. The program page is no plugin and
dispatches [ModifyProgramDataEvent](https://docs.typo3.org/permalink/fgtclb/academic-programs:developers-event-modify-program-data-event@main) instead.

## What this extension passes in {#what-this-extension-passes-in}

The view holds these variables when the event fires. A listener that assigns
one of them again replaces it in the templates.

| Content element | Variables |
| --- | --- |
| **Course List** | `programs`, `data` (the content element record as an array), `record`, `demand`, `categories`, `filterTypes`, `visitorSelection` and the `settings` |
| **Course Finder** | `data`, `record`, `categories`, `filterTypes`, `listUri`, `preselection`, `programCategories` (JSON) and the `settings` |
| **Course Data** | `data`, `record`, `program` (the `\FGTCLB\AcademicPrograms\Domain\Model\Program` of the page the element sits on, or `null`), `facts` and the `settings` |

`getSettings()` of the context returns the settings of the content
element merged over `plugin.tx_academicprograms.settings`, the
values of the site settings included.

## Example {#example}

A site places the **Course Data** element on its program pages and
wants a link below the facts that leads back to the program list. The site
already names that page in the site setting
`plugin.tx_academicprograms.page.listPid`, which the header of the
program page links to. The listener hands it to the view of the element:

**EXT:my_extension/Classes/EventListener/AddProgramListPageToProgramDetails.php**

```php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\EventListener;

use FGTCLB\AcademicBase\Event\ModifyPluginViewEvent;
use TYPO3\CMS\Core\Attribute\AsEventListener;

final class AddProgramListPageToProgramDetails
{
    #[AsEventListener(identifier: 'my-extension/add-program-list-page-to-program-details')]
    public function __invoke(ModifyPluginViewEvent $event): void
    {
        $context = $event->getPluginControllerActionContext();
        if ($context->getControllerExtensionName() !== 'AcademicPrograms'
            || $context->getPluginName() !== 'ProgramDetails'
        ) {
            return;
        }
        $listPid = (int)($context->getSite()?->getSettings()->get('plugin.tx_academicprograms.page.listPid', 0) ?? 0);
        $event->getView()->assign('programListPid', $listPid);
    }
}
```

An override of `Details/Show.html` renders the link while
`{programListPid}` is not 0. The setting is a site setting of the set
`fgtclb/academic-programs`. A site on the static templates sets it in its
`settings.yaml` as well, or the listener reads 0 there.

## Rules and pitfalls {#rules-and-pitfalls}

-   The event fires for the plugins of seven academic extensions. Check the
    extension name and the plugin name before acting, as the example does.
-   A variable the action assigned is replaced only in the view. The query has
    run already: programs a listener assigns as `programs` are rendered,
    but the filter keeps offering the categories of the queried programs. A
    change of which programs are shown belongs in
    [ModifyProgramDemandEvent](https://docs.typo3.org/permalink/fgtclb/academic-programs:developers-event-modify-program-demand-event@main) or
    [ModifyProgramListEvent](https://docs.typo3.org/permalink/fgtclb/academic-programs:developers-event-modify-program-list-event@main).
-   The finder hands `programCategories` to the browser as JSON. A
    listener that replaces it has to keep its shape, a list with one list of
    category uids per program, or the narrowing of the options stops.

## Introduced in {#introduced-in}

-   [Feature: The plugins dispatch the plugin view event](https://docs.typo3.org/permalink/fgtclb/academic-programs:feature-plugin-view-event@main) made the three content elements dispatch
    the event in 3.0.
-   [Breaking: The program controllers are final](https://docs.typo3.org/permalink/fgtclb/academic-programs:breaking-1791043408@main) names the event as the replacement of a
    subclass of `DetailsController` that added a view variable.
-   The event itself was introduced by
    [academic_base 3.0](https://docs.typo3.org/p/fgtclb/academic-base/main/en-us/Changelog/3.0/Feature-ModifyPluginViewEvent.html#feature-modify-plugin-view-event).
