仅在多站点安装的一个站点中使用 TYPO3 核心挂钩

using TYPO3 core hooks only in one site of a multi site installation

我在ext_localconf.php中定义了一个钩子:

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['typoLink_PostProc']['titleTagsInHiddenText'] = SNM\StmwiAccessibility\ExtendTypolink::class . '->convertTitleInHiddenText';

此挂钩将在页面上的每个 link 上执行,在所有站点的所有页面上。这可能是性能杀手......

那么,是否可以将挂钩的使用限制在实际页面上?是否可以在 ext_localconf.php 中获取当前站点?

例如:

$currentSite = ????;
if ($currentsite = 'rootPidOfMySite') {
    $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']
}

这个问题也在其他情况下出现:我经常想将扩展的性能消耗配置限制在一个站点上。我可以用静态安装文件来做,但不能用 ext_localconf.php.

中的东西

谢谢!

你用的是哪个TYPO3版本?有一个 API 访问站点配置。我会说你需要注册 PSR-15 中间件,然后你才能访问站点配置。可以在 documentation.

中找到更多详细信息