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.

New in version 13.0

The methods getIntegrityStatusCodes() and setIntegrityStatusCodes() have been added to the event class.

Example

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

declare(strict_types=1);

namespace MyVendor\MyExtension\Redirects\EventListener;

use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Redirects\Event\ModifyRedirectManagementControllerViewDataEvent;

#[AsEventListener(
    identifier: 'my-extension/modify-redirect-management-controller-view-data',
)]
final readonly 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!

New in version 13.0

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 ( )

Return the demand object used to retrieve the redirects.

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

Can be used to set the demand object.

param $demand

the demand

getRedirects ( )

Return the retrieved redirects.

Returns
array
setRedirects ( array $redirects)

Can be used to set the redirects, for example, after enriching redirect fields.

param $redirects

the redirects

getRequest ( )

Return the current PSR-7 request.

Returns
\Psr\Http\Message\ServerRequestInterface
getHosts ( )

Returns the hosts to be used for the host filter select box.

Returns
array
setHosts ( array $hosts)

Can be used to update which hosts are available in the filter select box.

param $hosts

the hosts

getStatusCodes ( )

Returns the status codes for the filter select box.

Returns
array
setStatusCodes ( array $statusCodes)

Can be used to update which status codes are available in the filter select box.

param $statusCodes

the statusCodes

getCreationTypes ( )

Returns creation types for the filter select box.

Returns
array
setCreationTypes ( array $creationTypes)

Can be used to update which creation types are available in the filter select box.

param $creationTypes

the creationTypes

getShowHitCounter ( )

Returns, if hit counter should be displayed.

Returns
bool
setShowHitCounter ( bool $showHitCounter)

Can be used to manage, if the hit counter should be displayed.

param $showHitCounter

the showHitCounter

getView ( )

Returns the current view object, without controller data assigned yet.

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

Can be used to assign additional data to the view.

param $view

the view

getIntegrityStatusCodes ( )

Returns all integrity status codes.

Returns
array
setIntegrityStatusCodes ( array $integrityStatusCodes)

Allows to set integrity status codes. It can be used to filter for integrity status codes.

param $integrityStatusCodes

the integrityStatusCodes