---
title: "ModifyPluginViewEvent"
manual: "Academic Projects"
version: "main"
permalink: "https://docs.typo3.org/permalink/fgtclb/academic-projects:developers-event-modify-plugin-view-event@main"
source: "Developers/Events/ModifyPluginViewEvent.rst"
rendered: "2026-10-26T19:20:38+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.
This page states what the plugins of **academic_projects** pass in.

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

Both content elements dispatch the event once per rendering, from
`ProjectController::listAction()`, after
[ModifyProjectListEvent](https://docs.typo3.org/permalink/fgtclb/academic-projects:developers-event-modify-project-list-event@main) and after the action assigned
its own variables:

| Content element | `getPluginName()` | `getActionName()` |
| --- | --- | --- |
| **Projects** | `ProjectList` | `list` |
| **Selected Projects** | `ProjectListSingle` | `list` |

`getControllerExtensionName()` returns `AcademicProjects` for both. A
submission of the filter form is answered with a redirect and renders nothing,
so it dispatches no event. The project page is no plugin and dispatches no
event.

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

The view holds these variables when the event fires: `projects`,
`demand`, `categories`, `filterTypes`,
`visitorSelection`, `data` (the content element record as an
array), `record` and the `settings`. A listener that assigns one of
them again replaces it in the templates.

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

## Example {#example}

A site places a **Selected Projects** element on each project page to
show related projects, and wants the card of the project the visitor is on to
look different, or to be left out. The listener hands the uid of the page
being rendered to the view:

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

```php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\EventListener;

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

final class AddCurrentPageToSelectedProjects
{
    #[AsEventListener(identifier: 'my-extension/add-current-page-to-selected-projects')]
    public function __invoke(ModifyPluginViewEvent $event): void
    {
        $context = $event->getPluginControllerActionContext();
        if ($context->getControllerExtensionName() !== 'AcademicProjects'
            || $context->getPluginName() !== 'ProjectListSingle'
        ) {
            return;
        }
        $pageInformation = $context->getRequest()->getAttribute('frontend.page.information');
        if ($pageInformation instanceof PageInformation) {
            $event->getView()->assign('currentPageUid', $pageInformation->getId());
        }
    }
}
```

An override of `Project/Item.html` compares `{project.uid}` with
`{currentPageUid}`. Both are uids of the default language, on a
translated page as well.

## 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: projects a listener assigns as `projects` are rendered,
    but the filter keeps offering the categories of the queried projects. A
    change of which projects are shown belongs in
    [ModifyProjectDemandEvent](https://docs.typo3.org/permalink/fgtclb/academic-projects:developers-event-modify-project-demand-event@main) or
    [ModifyProjectListEvent](https://docs.typo3.org/permalink/fgtclb/academic-projects:developers-event-modify-project-list-event@main).

## Introduced in {#introduced-in}

-   [Feature: The plugins dispatch the plugin view event](https://docs.typo3.org/permalink/fgtclb/academic-projects:feature-plugin-view-event@main) made both content elements dispatch the
    event in 3.0.
-   [Breaking: The project controller is final](https://docs.typo3.org/permalink/fgtclb/academic-projects:breaking-1791043407@main) made the controller final, which leaves the
    events as the way to add view variables.
-   The event itself was introduced by
    academic_base 3.0.
