I want to make a custom element that produces a list of categories and their subcategories.
My problem is the categories and subcategories come through as one single level array.
How can I produce a nested array so I can use fluid to loop over it?
10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
10 {
if.isTrue.field = categories
table = sys_category
selectFields = sys_category.*
pidInList = 55
recursive = 999
as = categories
}
Since you can nest data processors too, you just have to make sure to select parents only for the first level. Then you can get their children on the second level based on the parent's uid:
10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
10 {
if.isTrue.field = categories
table = sys_category
selectFields = sys_category.*
pidInList = 55
recursive = 999
where = parent = 0
as = categories
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
10 {
table = sys_category
selectFields = sys_category.*
pidInList = 55
recursive = 999
where.dataWrap = parent = {field:uid}
as = subcategories
}
}
}
Still it would be nice to get a specific category processor for the core. See https://forge.typo3.org/issues/82010