0

I have a custom content element that uses the records field. How can I put the records in this field into my fluid template?

I have tried doing this:

ext_example < lib.contentElement
ext_example {
    templateName = MyTemplate
    dataProcessing {
        10 = TYPO3\CMS\Frontend\DataProcessing\SplitProcessor
        10 {
          fieldName = records
          delimiter = ,
        }
    }
}

But it gives an array like this: 'tt_content_26,tt_content_30' How do I remove the prefix tt_content_ so I have a uid array that I can use?

user500665
  • 1,220
  • 1
  • 12
  • 38

1 Answers1

0

Per default, the records field allows only "tt_content" records. So, you have a list of UIDs of tt_content records in this field, but you're using these UIDs in the pidInList.

Julian Hofmann
  • 2,081
  • 1
  • 8
  • 16
  • 1
    If there's a type prefix in front of the UIDs, the records field is configured to allow different types of records. In this case, using the value of the records field in a query is difficult - because you do not know if there are only UIDs of the expected type. If you are **really** sure about the value, you might use stdWrap function (e.g replacement) – Julian Hofmann Oct 21 '19 at 07:32
  • So if records gives me `tt_content_1,tt_content_2,tt_content_3` how do I use replacement with SplitProcessor to get just the numbers? – user500665 Nov 06 '19 at 10:47
  • 1
    By using the SplitProcessor, you cannot modify/manipulate your input value. It splits simply the value of the given fieldName. Using the DatabaseQueryProcessor was a better solution. `uidInList { field = records stdWrap.replacement { 10 { search = tt_content_ replace = } } }` – Julian Hofmann Nov 07 '19 at 09:39