I have 2 COAs: lib.productContent
and lib.categoryContent
which contain data from a user function.
I also have a third COA – lib.seoColumns
– which should contain by default the product COA. If the product COA is empty, it should be overridden by the category COA, but I don’t know how to actually check if the product COA is empty:
########## PRODUCT CONTENT ##########
lib.productContent = COA
lib.productContent {
10 = USER
10 {
userFunc = VendorProviderUserFuncPage->getPageContentByAlias
alias = TEXT
alias.data = GP:product
aliasField.cObject = TEXT
aliasField.cObject.value = product_alias
}
}
########## CATEGORY CONTENT ##########
lib.categoryContent = COA
lib.categoryContent {
10 = USER
10 {
userFunc = VendorProviderUserFuncPage->getPageContentByAlias
alias = TEXT
alias.data = GP:category
aliasField.cObject = TEXT
aliasField.cObject.value = category_alias
}
}
########## SEO COLUMNS ##########
lib.seoColumns = COA
lib.seoColumns {
10 < lib.productContent
10.stdWrap.override.cObject < lib.categoryContent
# 10.stdWrap.override.if <-- IF WHAT ?
wrap = <seoColumns><![CDATA[|]]></seoColumns>
}
2
Answers
Just do it the other way around, since override only will do the actual override, when there is at least something in the overriding object.
https://docs.typo3.org/typo3cms/TyposcriptReference/Functions/Stdwrap/Index.html#override
no if necessary.
Easiest way would be to use the stdWrap .ifEmpty function
https://docs.typo3.org/typo3cms/TyposcriptReference/Functions/Stdwrap/Index.html#ifempty
as ifEmpty is of type string/stdWrap it supports stdWrap Attributes and we can use .cObject to load another Content Object. like the COA for the second case.