Skip to content

Commit

Permalink
[TASK] Allow stdWrap on MM SOLR_RELATION cObject
Browse files Browse the repository at this point in the history
Fixes: #3408
Relates: #3152
  • Loading branch information
b3nkai authored and dkd-kaehm committed Jan 25, 2023
1 parent ed3ce05 commit a7e43e6
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions Classes/ContentObject/Relation.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ protected function getRelatedItems(ContentObjectRenderer $parentContentObject):
$fieldTCA = $this->tcaService->getConfigurationForField($table, $field);

if (isset($fieldTCA['config']['MM']) && trim($fieldTCA['config']['MM']) !== '') {
$relatedItems = $this->getRelatedItemsFromMMTable($table, $overlayUid, $fieldTCA);
$relatedItems = $this->getRelatedItemsFromMMTable($table, $overlayUid, $fieldTCA, $parentContentObject);
} else {
$relatedItems = $this->getRelatedItemsFromForeignTable($table, $overlayUid, $fieldTCA, $parentContentObject);
}
Expand All @@ -169,8 +169,12 @@ protected function getRelatedItems(ContentObjectRenderer $parentContentObject):
* @throws AspectNotFoundException
* @throws DBALException
*/
protected function getRelatedItemsFromMMTable(string $localTableName, int $localRecordUid, array $localFieldTca): array
{
protected function getRelatedItemsFromMMTable(
string $localTableName,
int $localRecordUid,
array $localFieldTca,
ContentObjectRenderer $parentContentObject
): array {
$relatedItems = [];
$foreignTableName = $localFieldTca['config']['foreign_table'];
$foreignTableTca = $this->tcaService->getTableConfiguration($foreignTableName);
Expand All @@ -192,6 +196,7 @@ protected function getRelatedItemsFromMMTable(string $localTableName, int $local
}

$relatedRecords = $this->getRelatedRecords($foreignTableName, ...$selectUids);
$backupData = $parentContentObject->data;
foreach ($relatedRecords as $record) {
if (isset($foreignTableTca['columns'][$foreignTableLabelField]['config']['foreign_table'])
&& !empty($this->configuration['enableRecursiveValueResolution'])
Expand All @@ -212,8 +217,10 @@ protected function getRelatedItemsFromMMTable(string $localTableName, int $local
if ($this->getLanguageUid() > 0) {
$record = $this->frontendOverlayService->getOverlay($foreignTableName, $record);
}
$relatedItems[] = $record[$foreignTableLabelField];
$parentContentObject->data = $record;
$relatedItems[] = $parentContentObject->stdWrap($record[$foreignTableLabelField], $this->configuration);
}
$parentContentObject->data = $backupData;

return $relatedItems;
}
Expand Down

0 comments on commit a7e43e6

Please sign in to comment.