通过 dataProcessing / DatabaseQueryProcessor 获取 sys_category 项以显示在菜单中

Get sys_category items to show up in menu via dataProcessing / DatabaseQueryProcessor

菜单有效。但是猫总是空的。 data.categories 显示分配给给定页面的类别数。但是猫数组只显示:cats => array(empty)。我的 TYPOSCRIPT 有什么问题?

        40 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
        40 {
            expandAll = 1
            levels = 7
            as = menuMain
            dataProcessing {
                100 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
                100 {
                    if.isTrue.field = categories
                    table = sys_category
                    select {
                        pidInList = root,-1
                        selectFields = sys_category.*
                        join = sys_category_record_mm ON sys_category_record_mm.uid_local = sys_category.uid
                        where.data = field:_ORIG_uid // field:uid
                        where.intval = 1
                        where.wrap = sys_category_record_mm.uid_foreign=|
                        orderBy = sys_category_record_mm.sorting_foreign
                        languageField = 0 # disable translation handling of sys_category
                    }
                    as = cats
                }
            }
        }

尝试添加 recursive = 99 以查找所有页面。 我有一个有效类别的示例,请参阅:https://github.com/spoonerWeb/just_news/blob/master/Configuration/TypoScript/RenderingDefinitions/news_list.ts

DatabaseQueryProcessor 没有 "select" 参数。 所以你应该删除它并将所有子参数向上移动一级。

50 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
50 {
  if.isTrue.field = categories
  table = sys_category
  pidInList = root,-1
  selectFields = sys_category.*
  recursive = 99
  as = categories
}

这对我来说很有效。