(no commit message) master
authorChristian Weiske <cweiske@cweiske.de>
Fri, 22 Aug 2025 13:16:38 +0000 (15:16 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Fri, 22 Aug 2025 13:16:38 +0000 (15:16 +0200)
IndexedSearchHooks.php [new file with mode: 0644]
ext_localconf.php [new file with mode: 0644]

diff --git a/IndexedSearchHooks.php b/IndexedSearchHooks.php
new file mode 100644 (file)
index 0000000..87d67b5
--- /dev/null
@@ -0,0 +1,37 @@
+<?php\r
+namespace Vendor\Extension\Hooks;\r
+\r
+use TYPO3\CMS\Core\Domain\Repository\PageRepository;\r
+use TYPO3\CMS\Core\Utility\GeneralUtility;\r
+use TYPO3\CMS\IndexedSearch\Controller\SearchController;\r
+\r
+class IndexedSearchHooks\r
+{\r
+    public SearchController $pObj;\r
+\r
+    /**\r
+     * Load page row data into results\r
+     *\r
+     * Used to fetch images\r
+     *\r
+     * @param $result Keys:\r
+     *                - count\r
+     *                - searchWords\r
+     *                - rows\r
+     *                - affectedSections\r
+     */\r
+    public function getDisplayResults_postProc(array $result): array\r
+    {\r
+        $pageRepository = GeneralUtility::makeInstance(PageRepository::class);\r
+\r
+        foreach ($result['rows'] as $key => $row) {\r
+            if ($row['item_type'] != 0) {\r
+                continue;\r
+            }\r
+\r
+            $result['rows'][$key]['page_row'] = $pageRepository->getPage($row['page_id']);\r
+        }\r
+\r
+        return $result;\r
+    }\r
+}\r
diff --git a/ext_localconf.php b/ext_localconf.php
new file mode 100644 (file)
index 0000000..30f8f3e
--- /dev/null
@@ -0,0 +1,3 @@
+<?php\r
+$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['indexed_search']['pi1_hooks']['getDisplayResults_postProc']\r
+    = \Vendor\Extension\Hooks\IndexedSearchHooks::class;\r