Skip to content

Commit

Permalink
feat: more flexible record extension
Browse files Browse the repository at this point in the history
  • Loading branch information
jackd248 committed Nov 8, 2024
1 parent ebbdc02 commit 8c18d39
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Classes/Utility/ContentUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public static function getRecordsByFilter(?string $search = null, ?int $status =
$defaultSelects = [
'uid',
'pid',
'title',
'tstamp',
'tx_ximatypo3contentplanner_status',
'tx_ximatypo3contentplanner_assignee',
Expand All @@ -80,10 +79,11 @@ public static function getRecordsByFilter(?string $search = null, ?int $status =
continue;
}

$titleField = $GLOBALS['TCA'][$table]['ctrl']['label'];
if ($table === 'pages') {
$selects = array_merge($defaultSelects, ['"' . $table . '" as tablename', 'perms_userid', 'perms_groupid', 'perms_user', 'perms_group', 'perms_everybody']);
$selects = array_merge($defaultSelects, [$titleField . ' as title, "' . $table . '" as tablename', 'perms_userid', 'perms_groupid', 'perms_user', 'perms_group', 'perms_everybody']);
} else {
$selects = array_merge($defaultSelects, ['"' . $table . '" as tablename', '0 as perms_userid', '0 as perms_groupid', '0 as perms_user', '0 as perms_group', '0 as perms_everybody']);
$selects = array_merge($defaultSelects, [$titleField . ' as title, "' . $table . '" as tablename', '0 as perms_userid', '0 as perms_groupid', '0 as perms_user', '0 as perms_group', '0 as perms_everybody']);
}

$sqlArray[] = '(SELECT ' . implode(',', $selects) . ' FROM ' . $table . ' WHERE tx_ximatypo3contentplanner_status IS NOT NULL AND tx_ximatypo3contentplanner_status != 0' . $additionalWhere . ')';
Expand Down Expand Up @@ -207,7 +207,7 @@ public static function getExtensionRecords(string $table, ?int $pid = null): arr
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($table);

$query = $queryBuilder
->select('uid', 'title', 'tx_ximatypo3contentplanner_status', 'tx_ximatypo3contentplanner_assignee', 'tx_ximatypo3contentplanner_comments')
->select('uid', $GLOBALS['TCA'][$table]['ctrl']['label'] . ' as "title"', 'tx_ximatypo3contentplanner_status', 'tx_ximatypo3contentplanner_assignee', 'tx_ximatypo3contentplanner_comments')
->from($table)
->andWhere(
$queryBuilder->expr()->isNotNull('tx_ximatypo3contentplanner_status'),
Expand Down

0 comments on commit 8c18d39

Please sign in to comment.