Issue Feature Closed

#98240DatabaseQueryProcessor should be able to disregard language restrictions

Tizian Schmidlin 09/01/22, 09:28 updated 09/06/22, 18:30

Description

We have a card element on our site, that is built on pages records.

What it does, is get the nine first pages from the database that match the selected categories. This works fine, as long as there is no l18n_cfg involved.

{{collapse(View Typoscript configuration…)

###############
#### CARDS ####
###############
tt_content.cards =< lib.contentElement
tt_content.cards {

  ################
  ### TEMPLATE ###
  ################
  templateName = Cards

  #######################
  ### DATA PROCESSING ###
  #######################
  dataProcessing {
    10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
    10 {
      special = list
      special.value.field = pages
      excludeUidList = current
      includeNotInMenu = 1
      maxItems = 9
      as = pages
      dataProcessing {

        10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
        10 {
          references.fieldName = media
          as = media
        }

        20 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
        20 {
          if.isTrue.field = categories
          table = sys_category
          selectFields = sys_category.title
          pidInList = 103
          join = sys_category_record_mm ON (sys_category.uid = sys_category_record_mm.uid_local OR sys_category.l10n_parent = sys_category_record_mm.uid_local)
          where.data = field:uid
          where.wrap = sys_category_record_mm.tablenames = 'pages' AND sys_category_record_mm.fieldname = 'categories' AND sys_category_record_mm.uid_foreign = '|'
          as = categories
        }
      }
    }

    20 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
    20 {
      if.isFalse.field = pages
      table = pages
      selectFields = pages.*
      pidInList = 1
      recursive = 99
      join (
        sys_category_record_mm AS c1 ON pages.uid = c1.uid_foreign AND c1.tablenames = 'pages' AND c1.fieldname = 'categories'
        LEFT JOIN sys_category_record_mm AS c2 ON pages.uid = c2.uid_foreign AND c2.tablenames = 'pages' AND c2.fieldname = 'subjects'
      )
      where = FIND_IN_SET(c1.uid_local, '{field:selected_categories}') AND ((FIND_IN_SET(c2.uid_local, '{field:selected_subjects}') OR '' = '{field:selected_subjects}')) AND pages.uid != {page:uid} and pages.l10n_parent != {page:uid}
      where.insertData = 1
      groupBy = pages.uid
      orderBy = date DESC
      max = 9
      as = pages
      dataProcessing {

        10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
        10 {
          references.fieldName = media
          as = media
        }

        20 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
        20 {
          if.isTrue.field = categories
          table = sys_category
          selectFields = sys_category.title
          pidInList = 103
          join = sys_category_record_mm ON (sys_category.uid = sys_category_record_mm.uid_local OR sys_category.l10n_parent = sys_category_record_mm.uid_local)
          where.data = field:uid
          where.wrap = sys_category_record_mm.tablenames = 'pages' AND sys_category_record_mm.fieldname = 'categories' AND sys_category_record_mm.uid_foreign = '|'
          as = categories
        }
      }
    }
  }
}

}}

The part I’m interested in is tt_content.cards.dataProcessing.20.where, where I don’t check for anything l18n_cfg related (yet) but when I look at the generated SQL, I see that it will always get the default language in order to be able to make the translation later.

The problem is, that this will lead to content being displayed in the default language anyway, completely disregarding l18n_cfg. I would be able to check for this in the template, but this seems inappropriate and also does not let me get 9 results everytime.

What I’d be looking for is a way to disable the language restriction on the DatabaseQueryProcessor but as far as I’ve seen, this is not possible?

Therefore I propose to add this in some future version of TYPO3 (or I’ll build an extension that allows this, if the interest of the community is too low).

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.