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'] !== '*');

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

API

class \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 ( )
returntype

TYPO3\CMS\Redirects\Repository\Demand

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

the demand

getRedirects ( )
returntype

array

setRedirects ( array $redirects)
param array $redirects

the redirects

getRequest ( )
returntype

Psr\Http\Message\ServerRequestInterface

getHosts ( )
returntype

array

setHosts ( array $hosts)
param array $hosts

the hosts

getStatusCodes ( )
returntype

array

setStatusCodes ( array $statusCodes)
param array $statusCodes

the statusCodes

getCreationTypes ( )
returntype

array

setCreationTypes ( array $creationTypes)
param array $creationTypes

the creationTypes

getShowHitCounter ( )
returntype

bool

setShowHitCounter ( bool $showHitCounter)
param bool $showHitCounter

the showHitCounter

getView ( )
returntype

TYPO3\CMS\Core\View\ViewInterface

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

the view