TYPO3:在 foreign_table_where 的 TCA 中设置 PAGE_TSCONFIG_STR

TYPO3: Set PAGE_TSCONFIG_STR in TCA for foreign_table_where

使用以下 TCA 配置,我正在尝试为 foreign_table_where

设置 PAGE_TSCONFIG_STR 标记

TCA 字段配置:

'my_field' => [
    'exclude' => 1,
    'l10n_mode' => 'mergeIfNotBlank',
    'label' => 'The label',
    'config' => [
        'type' => 'select',
        'renderType' => 'selectMultipleSideBySide',
        'enableMultiSelectFilterTextfield' => true,
        'foreign_table' => 'tx_my_foreign_table',
        'foreign_table_where' => ' ###PAGE_TSCONFIG_STR### AND tx_my_foreign_table.deleted = 0 AND tx_my_foreign_table.hidden = 0 AND tx_my_foreign_table.sys_language_uid = ###REC_FIELD_sys_language_uid### ORDER BY tx_my_foreign_table.lastname ASC, tx_my_foreign_table.firstname ASC',
        'MM' => 'tx_my_table_mm',
        'size' => 10,
        'autoSizeMax' => 30,
        'maxitems' => 99,
    ],
],

设置如下Page TSConfig后,就再也没有获取到任何外来记录了:

TCEFORM.tx_table.my_field.PAGE_TSCONFIG_STR = AND tx_my_foreign_table.pid = 1

这在 TYPO3 7 中运行良好,但在 TYPO3 8 中停止运行。我需要为 TYPO3 8 更改任何内容吗?

编辑

我做了更多的调试,并将这个问题追踪到第 1139 行的 class TYPO3\CMS\Backend\Form\FormDataProvider\AbstractItemProvider。在这里你会找到以下代码:

$pageTsConfigString = $connection->quote($pageTsConfigString);

这导致 'AND tx_my_foreign_table.pid = 1'(带引号!),这将生成此 foreignTableClause - 这当然是错误的,因为引号:

'AND tx_mdnewsauthor_domain_model_newsauthor.pid = 1' AND tx_my_foreign_table.deleted = 0 AND tx_my_foreign_table.hidden = 0 AND tx_my_foreign_table.sys_language_uid = 0 ORDER BY tx_my_foreign_table.lastname ASC, tx_my_foreign_table.firstname ASC

现在我的新问题:这是一个错误还是我做错了什么?

不要将 SQL 代码放在 TsConfig 中,将其放入 TCA 中。

'foreign_table_where' => ' AND ( ###PAGE_TSCONFIG_STR### = \'FALSE\' OR tx_my_foreign_table.pid = ###PAGE_TSCONFIG_STR### ) AND tx_my_foreign_table.deleted = 0 AND tx_my_foreign_table.hidden = 0 AND tx_my_foreign_table.sys_language_uid = ###REC_FIELD_sys_language_uid### ORDER BY tx_my_foreign_table.lastname ASC, tx_my_foreign_table.firstname ASC',

TCEFORM.tx_table.my_field.PAGE_TSCONFIG_STR = FALSE