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. 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 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);
    }
}

New in version 13.0: The PHP attribute \TYPO3\CMS\Core\Attribute\AsEventListener has been introduced to tag a PHP class as an event listener. Alternatively, or if you need to be compatible with older TYPO3 versions, you can also register an event listener via the Configuration/Services.yaml file. Switch to an older version of this page for an example or have a look at the section Implementing an event listener in your extension.

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

Return the demand object used to retrieve the redirects.

Return type

TYPO3\CMS\Redirects\Repository\Demand

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

Can be used to set the demand object.

Parameters
  • $demand (TYPO3\CMS\Redirects\Repository\Demand) -- the demand

getRedirects()

Return the retrieved redirects.

Return type

array

setRedirects(array $redirects)

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

Parameters
  • $redirects (array) -- the redirects

getRequest()

Return the current PSR-7 request.

Return type

Psr\Http\Message\ServerRequestInterface

getHosts()

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

Return type

array

setHosts(array $hosts)

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

Parameters
  • $hosts (array) -- the hosts

getStatusCodes()

Returns the status codes for the filter select box.

Return type

array

setStatusCodes(array $statusCodes)

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

Parameters
  • $statusCodes (array) -- the statusCodes

getCreationTypes()

Returns creation types for the filter select box.

Return type

array

setCreationTypes(array $creationTypes)

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

Parameters
  • $creationTypes (array) -- the creationTypes

getShowHitCounter()

Returns, if hit counter should be displayed.

Return type

bool

setShowHitCounter(bool $showHitCounter)

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

Parameters
  • $showHitCounter (bool) -- the showHitCounter

getView()

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

Return type

TYPO3\CMS\Core\View\ViewInterface

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

Can be used to assign additional data to the view.

Parameters
  • $view (TYPO3\CMS\Core\View\ViewInterface) -- the view

getIntegrityStatusCodes()

Returns all integrity status codes.

Return type

array

setIntegrityStatusCodes(array $integrityStatusCodes)

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

Parameters
  • $integrityStatusCodes (array) -- the integrityStatusCodes