Skip to content

Commit 3bf0a14

Browse files
committed
[TASK] SOLR_RELATION respect enableFields on MM-related records
The RelationHandler doesn't respect enableFields of the table behind the MM-relation. Because this has been in place for quite a long time. A new option respectEnablefieldsMM is introduced, which can be set as configuration parameter when using SOLR_RELATION to filter e.g. hidden categories. Resolves #65692 Change-Id: Icc04f32ca1912c8d81b7bfd913490cf7efc36152
1 parent 6b6889c commit 3bf0a14

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Classes/ContentObject/Relation.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,13 @@ protected function getRelatedItemsFromMMTable($localTableName, $localRecordUid,
268268

269269
$selectUids = $relationHandler->tableArray[$foreignTableName];
270270
if (is_array($selectUids) && count($selectUids) > 0) {
271+
$pageSelector = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
272+
$whereClause = $pageSelector->enableFields( $foreignTableName );
271273
$relatedRecords = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
272274
'uid, pid, ' .$foreignTableLabelField,
273275
$foreignTableName,
274276
'uid IN (' . implode(',', $selectUids) . ')'
275-
. BackendUtility::deleteClause($foreignTableName)
277+
. $whereClause
276278
);
277279
foreach ($relatedRecords as $record) {
278280
if ($GLOBALS['TSFE']->sys_language_uid > 0) {
@@ -321,4 +323,4 @@ protected function getTranslationOverlay($tableName, $record) {
321323
}
322324
}
323325

324-
}
326+
}

0 commit comments

Comments
 (0)