Skip to content

Commit 0046f84

Browse files
authored
fix: category filter to ignore configured TCAdefaults (#109)
1 parent f674878 commit 0046f84

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

Classes/Middleware/CategoryTreeManipulation.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
2525

2626
$params = $request->getQueryParams();
2727
$overrideValues = json_decode($params['overrideValues'] ?? '[]', true, 512, JSON_THROW_ON_ERROR);
28+
$overrideValues = array_map(static fn ($value): int => (int)$value, $overrideValues);
29+
$recordTypeValue = $params['recordTypeValue'] ?? '';
2830
$command = $params['command'] ?? '';
2931

3032
// make sure it is the right request
31-
if (empty($overrideValues) || $command !== 'new') {
33+
if ($recordTypeValue !== 'tx-ximatypo3recordlist-filter' || $command !== 'new') {
3234
return $handler->handle($request);
3335
}
3436

@@ -37,10 +39,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
3739
$response = $handler->handle($request);
3840
$treeData = json_decode($response->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR);
3941
foreach ($treeData as &$treeItem) {
40-
if (!in_array((int)$treeItem['identifier'], $overrideValues, true)) {
41-
continue;
42-
}
43-
$treeItem['checked'] = true;
42+
$treeItem['checked'] = in_array((int)$treeItem['identifier'], $overrideValues, true);
4443
}
4544
return new JsonResponse($treeData);
4645
} catch (\Exception) {

Resources/Private/Partials/Filter/Category.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
data-tablename="{tableName}"
2828
data-read-only=""
2929
data-tree-show-toolbar="0"
30-
data-recordtypevalue="1"
30+
data-recordtypevalue="tx-ximatypo3recordlist-filter"
3131
data-relatedfieldname=""
3232
data-flexformsheetname=""
3333
data-flexformfieldname=""

0 commit comments

Comments
 (0)