I have a content element that stores values in a FlexForm (eg. 1234). The value represents an UID of a database table.
What i want to do:
Problem: I don't know how to hand over the FlexForm value to the where-clause of the DB query.
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
}
}
}
}
Thank you in advance.
If you just want to access the flexform value from your plugin/content element you can do that without a custom FlexFormProcessor. Use the data type flexform
, e.g. like this:
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
10 {
table = tt_address
pidInList = 19
uidInList.data = flexform:pi_flexform:settings.myuid
}
}
You need to adjust settings.myuid
according to the naming in your flexform. See the TypoScript Reference for details on the data type flexform
.
If you need your custom FlexFormProcessor, you need to nest the dataProcessing, something like this:
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
}
}
}
}
The important line is the where.wrap
where you use the value from the first dataProcessing.