Feature: #99409 - New PSR-14 BeforeLiveSearchFormIsBuiltEvent
See forge#99409
Description
A new PSR-14 event
\TYPO3\
has been added.
To modify the live search form data, the following methods are available:
add: Adds a single hint.Hint () add: Adds one or multiple hints.Hints () set: Sets hints and can be used to reset or overwrite the current ones.Hints () get: Returns all current hints.Hints () get: Returns the current PSR-7 request.Request () get: Returns theSearch Demand () Searchused by the live search.Demand set: Sets a customSearch Demand () Searchobject.Demand get: Returns the additional view data set to be used in the template.Additional View Data () set: Sets the additional view data to be used in the template.Additional View Data ()
Note
The method
set is useful to provide additional
data to the template without the need to cross-class (XCLASS) the controller.
The additional view data can then be used in an overridden backend template
of the live search form.
Example
The corresponding event listener class:
<?php
namespace MyVendor\MyPackage\Backend\Search\EventListener;
use TYPO3\CMS\Backend\Search\Event\BeforeLiveSearchFormIsBuiltEvent;
use TYPO3\CMS\Core\Attribute\AsEventListener;
final class BeforeLiveSearchFormIsBuiltEventListener
{
#[AsEventListener(
identifier: 'my-package/backend/search/modify-live-search-form-data'
)]
public function __invoke(BeforeLiveSearchFormIsBuiltEvent $event): void
{
$event->addHints(...[
'my-extension.messages:identifier',
]);
}
}
Copied!
Impact
With the new PSR-14 event
Before, it is now
possible to modify the form data for the backend live search.