Skip to content

Instantly share code, notes, and snippets.

@cepheiVV
Created May 24, 2019 06:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cepheiVV/1d4fc6ef2eea965693faf7085b371833 to your computer and use it in GitHub Desktop.
Save cepheiVV/1d4fc6ef2eea965693faf7085b371833 to your computer and use it in GitHub Desktop.
TYPO3 - Index EXT:mask content with EXT:ke_search
<?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;
<?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']);
}
}
@christianbltr
Copy link

Thanks for sharing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment