---
title: "Feature: #99220 - Add event to modify search results"
manual: "TYPO3 Core Changelog"
version: "main"
permalink: "https://docs.typo3.org/permalink/changelog:feature-99220-1670250156"
source: "Changelog/12.2/Feature-99220-AddEventToModifySearchResults.rst"
typo3-version: "12.2"
typo3-major: 12
type: "feature"
issue: 99220
forge: "https://forge.typo3.org/issues/99220"
tags: ["Backend", "ext:backend"]
rendered: "2026-09-20T18:31:11+00:00"
---

# Feature: #99220 - Add event to modify search results {#feature-99220-1670250156}

See [forge#99220](https://forge.typo3.org/issues/99220)

## Description {#description}

A new PSR-14 event `\TYPO3\CMS\Backend\Search\Event\ModifyResultItemInLiveSearchEvent`
is added to allow extension developers to take control over search result items
rendered in the backend search.

The event has a public method called `getResultItem()`, returning the
`\TYPO3\CMS\Backend\Search\LiveSearch\ResultItem` instance of the search
result item.

## Impact {#impact}

Search result items may be modified within a custom event listener, e.g. to add
custom actions.

### Example {#example}

**EXT:my_extension/Classes/Search/EventListener/AddLiveSearchResultActionsListener.php**

```php
<?php

namespace MyVendor\MyExtension\Search\EventListener;

use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Backend\Search\Event\ModifyResultItemInLiveSearchEvent;
use TYPO3\CMS\Backend\Search\LiveSearch\DatabaseRecordProvider;
use TYPO3\CMS\Backend\Search\LiveSearch\ResultItemAction;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Localization\LanguageServiceFactory;

final class AddLiveSearchResultActionsListener
{
    protected LanguageService $languageService;

    public function __construct(
        protected readonly IconFactory $iconFactory,
        protected readonly LanguageServiceFactory $languageServiceFactory,
        protected readonly UriBuilder $uriBuilder
    ) {
        $this->languageService = $this->languageServiceFactory->createFromUserPreferences($GLOBALS['BE_USER']);
    }

    public function __invoke(ModifyResultItemInLiveSearchEvent $event): void
    {
        $resultItem = $event->getResultItem();
        if ($resultItem->getProviderClassName() !== DatabaseRecordProvider::class) {
            return;
        }

        if (($resultItem->getExtraData()['table'] ?? null) === 'tt_content') {
            /**
             * WARNING: THIS EXAMPLE OMITS ANY ACCESS CHECK FOR SIMPLICITY REASONS.
             *          DO NOT USE AS-IS!
             */
            $showHistoryAction = (new ResultItemAction('view_history'))
                ->setLabel($this->languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:history'))
                ->setIcon($this->iconFactory->getIcon('actions-document-history-open', Icon::SIZE_SMALL))
                ->setUrl((string)$this->uriBuilder->buildUriFromRoute('record_history', [
                    'element' => $resultItem->getExtraData()['table'] . ':' . $resultItem->getExtraData()['uid']
                ]));
            $resultItem->addAction($showHistoryAction);
        }
    }
}
```

**EXT:my_extension/Configuration/Services.yaml**

```yaml
MyVendor\MyExtension\Search\EventListener\AddLiveSearchResultActionsListener:
  tags:
    - name: event.listener
      identifier: 'site/add-live-search-result-actions-listener'
```
