Typo3 - 在 TypoScript 中为 DataQueryProcessor 使用 FlexForm 值

Typo3 - Use FlexForm value for DataQueryProcessor in TypoScript

我有一个内容元素将值存储在 FlexForm 中(例如 1234)。该值表示数据库的 UID table.

我想做什么:

问题: 我不知道如何将 FlexForm 值交给数据库查询的 where 子句。

tt_content {
  my_addresscontainer =< lib.contentElement
  my_addresscontainer {

    templateName = AddressContainer
    templateRootPaths {
      10 = EXT:xyz/Resources/Private/Partials/ContentElements/
    }
    partialRootPaths {
      10 = EXT:xyz/Resources/Private/Partials
    }

    dataProcessing {
        1 = xyz\DataProcessing\FlexFormProcessor
        1 {
            options {
                if.isTrue.field = pi_flexform
                fieldName = pi_flexform
            }
            as = content
        }

        10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
               10 {
                  table = tt_address
                  pidInList = 19
                  markers {
                        myuid.value = 191901 <- This should be handed over...
                  }
                  where = uid =###myuid###
                  as = address_record
                }
    }
  }
}

提前致谢。

如果您只想从 plugin/content 元素访问 flexform 值,您可以在没有自定义 FlexFormProcessor 的情况下实现。使用数据类型 flexform,例如像这样:

dataProcessing {
  10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
  10 {
    table = tt_address
    pidInList = 19
    uidInList.data = flexform:pi_flexform:settings.myuid
  }
}

您需要根据您的 flexform 中的命名来调整 settings.myuid。有关 data type flexform.

的详细信息,请参阅 TypoScript 参考

如果您需要自定义 FlexFormProcessor,则需要嵌套数据处理,如下所示:

dataProcessing {
  1 = xyz\DataProcessing\FlexFormProcessor
  1 {
    options {
      if.isTrue.field = pi_flexform
      fieldName = pi_flexform
    }
    as = content

    dataProcessing {
      1 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
      1 {
        table = tt_address
        pidInList = 19
        markers {
              myuid.value = 191901 <- This should be handed over...
        }
        where.wrap = uid =|
        as = address_record
      }
    }
  }
}

重要的一行是 where.wrap,您在其中使用第一个数据处理中的值。