replacetypo3overwrite

TYPO3. How to overwrite class in Indexed Search extension


I want to overwrite class IndexedSearchUtility by my own class IndexedSearchUtility which is located in my site-package. I tried this in my code.

In ext_localconf.php:

$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects']['TYPO3\\CMS\\IndexedSearch\\Utility\\IndexedSearchUtility'] = ['IndexedSearchUtility' => 'EXT:my_site_package/Classes/Utility/IndexedSearchUtility'];

or

$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects']['TYPO3\\CMS\\IndexedSearch\\Utility\\IndexedSearchUtility'] = [
'IndexedSearchUtility' => 'MyVendor\\MySitePackage\\Utility\\IndexedSearchUtility'];

In IndexedSearchUtility.php

class IndexedSearchUtility extends TYPO3\CMS\IndexedSearch\Utility\IndexedSearchUtility
{ 
   ...
}

Solution

  • IndexedSearchUtility contains only static methods, XCASS'ing static methods does not work.

    https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/Xclasses/Index.html

    You'd have to override (non-static) callers if necessary.