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.
Example¶
Registration of the event listener in the extension's Services.yaml
:
MyVendor\MyExtension\Redirects\EventListener\MyEventListener:
tags:
- name: event.listener
identifier: 'my-extension/modify-redirect-management-controller-view-data'
The corresponding event listener class:
<?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);
}
}
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 type
TYPO3\CMS\Redirects\Repository\Demand
- setDemand(TYPO3\\CMS\\Redirects\\Repository\\Demand $demand)¶
- Parameters
$demand (
TYPO3\CMS\Redirects\Repository\Demand
) -- the demand
- getRedirects()¶
- Return type
array
- setRedirects(array $redirects)¶
- Parameters
$redirects (
array
) -- the redirects
- getRequest()¶
- Return type
Psr\Http\Message\ServerRequestInterface
- getHosts()¶
- Return type
array
- setHosts(array $hosts)¶
- Parameters
$hosts (
array
) -- the hosts
- getStatusCodes()¶
- Return type
array
- setStatusCodes(array $statusCodes)¶
- Parameters
$statusCodes (
array
) -- the statusCodes
- getCreationTypes()¶
- Return type
array
- setCreationTypes(array $creationTypes)¶
- Parameters
$creationTypes (
array
) -- the creationTypes
- getShowHitCounter()¶
- Return type
bool
- setShowHitCounter(bool $showHitCounter)¶
- Parameters
$showHitCounter (
bool
) -- the showHitCounter
- getView()¶
- Return type
TYPO3\CMS\Core\View\ViewInterface
- setView(TYPO3\\CMS\\Core\\View\\ViewInterface $view)¶
- Parameters
$view (
TYPO3\CMS\Core\View\ViewInterface
) -- the view