TYPO3-Headless / headless

TYPO3 Headless JSON API providing content for PWA application (e.g. javaScript apps like nuxt-typo3)
https://t3headless.io
GNU General Public License v2.0
159 stars 60 forks source link

No categories in Standard CEs #689

Open bernhardberger opened 10 months ago

bernhardberger commented 10 months ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior: Create a CE (doesn't seem to matter which, tried Images and File Links) and add Categories image

API doesn't output any categories, just an empty string. image

Expected behavior To get Categories in any form

TYPO3 version and TYPO3 Headless version TYPO3 12.4.8, EXT:headless 4.2.3

schloram commented 10 months ago

@bernhardberger Where are your category records stored?

bernhardberger commented 10 months ago

Not on pid=0.

I figured it out that the TS select only gets categories from the root pid. Not sure if that's a good default tbh, especially for sites with multi tree.

schloram commented 10 months ago

@bernhardberger Yes that is he issue here. Even though the TYPO3 Documentation has an example to get categories from root I don't think it's ideal since you might want to have different categories for different site roots.

In this case it would be better to use pidInList = leveluid : 0 with recursive imho. But since this would ignore the records from root (page uid 0) completely you would be better of overriding lib.contentElement.fields.categories with these changes yourself.

Another approach would be using pidInList = root with recursive to get every category from the root and below.

lukaszuznanski commented 9 months ago

I think it needs to be specified per project, but we can think of better default setting. @schloram approach with pidInList = root and recursive sounds good for starting point.