ModifyRedirectManagementControllerViewDataEvent
New in version 12.3
The PSR-14 event
\TYPO3\
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 get
and
set
have been added to the event class.
Example
<?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);
}
}
New in version 13.0
The PHP attribute \TYPO3\
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/
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 ModifyRedirectManagementControllerViewDataEvent
-
- Fully qualified name
-
\TYPO3\
CMS\ Redirects\ Event\ Modify Redirect Management Controller View Data Event
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
- setRedirects ( array $redirects)
-
Can be used to set the redirects, for example, after enriching redirect fields.
- param $redirects
-
the redirects
- setHosts ( array $hosts)
-
Can be used to update which hosts are available in the filter select box.
- param $hosts
-
the hosts
- setStatusCodes ( array $statusCodes)
-
Can be used to update which status codes are available in the filter select box.
- param $statusCodes
-
the statusCodes
- setCreationTypes ( array $creationTypes)
-
Can be used to update which creation types are available in the filter select box.
- param $creationTypes
-
the creationTypes
- 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\ View Interface