ModifyRedirectManagementControllerViewDataEvent

New in version 12.3

The PSR-14 event \TYPO3\CMS\Redirects\Event\ModifyRedirectManagementControllerViewDataEvent allows extensions to modify or enrich view data for EXT:redirects/Classes/Controller/ManagementController.php (GitHub). This makes it possible to display more or other information along the way.

For example, this event can be used to add additional information to current page records.

Therefore, it can be used to generate custom data, directly assigning to the view. With overriding the backend view template via page TSconfig this custom data can be displayed where it is needed and rendered the way it is wanted.

Example

Registration of the event listener in the extension's Services.yaml:

EXT:my_extension/Configuration/Services.yaml
services:
  # Place here the default dependency injection configuration

  MyVendor\MyExtension\Redirects\EventListener\MyEventListener:
    tags:
      - name: event.listener
        identifier: 'my-extension/modify-redirect-management-controller-view-data'
Copied!

Read how to configure dependency injection in extensions.

The corresponding event listener class:

EXT:my_extension/Classes/Redirects/EventListener/MyEventListener.php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\Redirects\EventListener;

use TYPO3\CMS\Redirects\Event\ModifyRedirectManagementControllerViewDataEvent;

final class MyEventListener
{
    public function __invoke(ModifyRedirectManagementControllerViewDataEvent $event): void
    {
        $hosts = $event->getHosts();

        // Remove wildcard host from list
        $hosts = array_filter($hosts, static fn($host) => $host['name'] !== '*');

        // Update changed hosts list
        $event->setHosts($hosts);
    }
}
Copied!

API

class ModifyRedirectManagementControllerViewDataEvent
Fully qualified name
\TYPO3\CMS\Redirects\Event\ModifyRedirectManagementControllerViewDataEvent

This event is fired in the TYPO3CMSRedirectsControllerManagementController handleRequest() method.

It can be used to further enrich view data for the management view.

getDemand ( )
Returns
\TYPO3\CMS\Redirects\Repository\Demand
setDemand ( \TYPO3\CMS\Redirects\Repository\Demand $demand)
param $demand

the demand

getRedirects ( )
Returns
array
setRedirects ( array $redirects)
param $redirects

the redirects

getRequest ( )
Returns
\Psr\Http\Message\ServerRequestInterface
getHosts ( )
Returns
array
setHosts ( array $hosts)
param $hosts

the hosts

getStatusCodes ( )
Returns
array
setStatusCodes ( array $statusCodes)
param $statusCodes

the statusCodes

getCreationTypes ( )
Returns
array
setCreationTypes ( array $creationTypes)
param $creationTypes

the creationTypes

getShowHitCounter ( )
Returns
bool
setShowHitCounter ( bool $showHitCounter)
param $showHitCounter

the showHitCounter

getView ( )
Returns
\TYPO3\CMS\Core\View\ViewInterface
setView ( \TYPO3\CMS\Core\View\ViewInterface $view)
param $view

the view