---
title: "ModifyPluginViewEvent"
manual: "Academic Contacts for Pages"
version: "main"
permalink: "https://docs.typo3.org/permalink/fgtclb/academic-contacts4pages:developers-event-modify-plugin-view-event@main"
source: "Developers/Events/ModifyPluginViewEvent.rst"
rendered: "2026-10-26T19:20:19+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 once the plugin has
assigned its own variables, so a listener adds a variable to the templates
without replacing the controller. The event itself, and the rules that apply to
every plugin, are described on [its page in the manual 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 describes what the content element of
**academic_contacts4pages** passes in.

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

`ContactsController::listAction()` dispatches it once each time the
content element [Person’s Contacts on the Page](https://docs.typo3.org/permalink/fgtclb/academic-contacts4pages:integrator-contacts-list@main)
renders, as the last step of the action, after
[ModifyPageContactsEvent](https://docs.typo3.org/permalink/fgtclb/academic-contacts4pages:developers-event-modify-page-contacts-event@main) and
after the view variables are assigned. The data processor for page templates
renders no plugin and does not dispatch it.

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

| Method | Returns |
| --- | --- |
| `getPluginControllerActionContext()` | The context of the content element: the extension name `AcademicContacts4pages`, the plugin name `List`, the action name `list`, the request, the site and its language, the content object, and the settings of the content element, its FlexForm merged over `plugin.tx_academiccontacts4pages.settings`. |
| `getView()` | The view, with `{contacts}`, `{roles}`, `{contactsWithoutRole}`, `{data}` and `{record}` assigned. |

## Example {#example}

A site shows a link to its contact form below the contacts of every page. The
uid of the page with the form is a site setting of the site package, and a
listener hands it to the template of the content element:

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

```php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\EventListener;

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

final class AddContactFormPageToThePageContacts
{
    #[AsEventListener(identifier: 'my-extension/add-contact-form-page-to-the-page-contacts')]
    public function __invoke(ModifyPluginViewEvent $event): void
    {
        $context = $event->getPluginControllerActionContext();
        if ($context->getControllerExtensionName() !== 'AcademicContacts4pages'
            || $context->getPluginName() !== 'List'
        ) {
            return;
        }
        $pageUid = (int)($context->getSite()?->getSettings()->get('myExtension.contactFormPage') ?? 0);
        if ($pageUid > 0) {
            $event->getView()->assign('contactFormPage', $pageUid);
        }
    }
}
```

An override of `Templates/Contacts/List.html` renders the link with
`<f:link.page pageUid="{contactFormPage}">`.

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

**Check the extension name as well as the plugin name.** `List` is the
plugin name of plugins of other academic extensions too.

**A replaced variable is replaced in the view only.** Which contacts a page
shows belongs in
[ModifyPageContactsEvent](https://docs.typo3.org/permalink/fgtclb/academic-contacts4pages:developers-event-modify-page-contacts-event@main),
which reaches the data processor as well, and which keeps the roles and the
contacts without role in line with the contacts.

**The content element is cached.** It is rendered when the page is rendered,
and the page is cached with what the listener assigned, so a listener cannot
assign something different for different visitors.

## Introduced in {#introduced-in}

-   [Feature: The plugin dispatches the plugin view event](https://docs.typo3.org/permalink/fgtclb/academic-contacts4pages:feature-plugin-view-event@main) made the content element dispatch the
    event.
