Created
May 24, 2019 06:30
-
-
Save cepheiVV/1d4fc6ef2eea965693faf7085b371833 to your computer and use it in GitHub Desktop.
TYPO3 - Index EXT:mask content with EXT:ke_search
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// register hooks for indexing additional tt_content fields | |
$additionContentClassName = 'VENDOR\MyCustomExtension\Hooks\KeSearchAdditionalContentFields'; | |
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyPageContentFields'][] = $additionContentClassName; | |
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyContentFromContentElement'][] = $additionContentClassName; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace VENDOR\MyCustomExtension\Hooks; | |
class KeSearchAdditionalContentFields { | |
/** | |
* add tx_mask field from tt_content table | |
*/ | |
public function modifyPageContentFields(&$fields, $pageIndexer) | |
{ | |
$fields .= ",tx_mask_customcontent1,tx_mask_customcontent2,tx_mask_customcontent3"; | |
} | |
/** | |
* | |
*/ | |
public function modifyContentFromContentElement(string &$bodytext, array $ttContentRow, $pageIndexer) | |
{ | |
$bodytext .= strip_tags($ttContentRow['tx_mask_customcontent1']); | |
$bodytext .= strip_tags($ttContentRow['tx_mask_customcontent2']); | |
$bodytext .= strip_tags($ttContentRow['tx_mask_customcontent3']); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for sharing!