TYPO3-Headless / headless

TYPO3 Headless JSON API providing content for PWA application (e.g. javaScript apps like nuxt-typo3)
https://t3headless.io
GNU General Public License v2.0
159 stars 60 forks source link

COA_INT as wrapper on lib.contentElementWithHeader for no_cache? #738

Open simonhantha opened 5 months ago

simonhantha commented 5 months ago

Hey guys,

my goal would be to disable cache for a specific (custom) content element on a page.

But if I try to wrap a lib.contentElementWithHeader with COA_INT I get the following exception: Trying to access array offset on value of type null in /ext/headless/Classes/ContentObject/JsonContentContentObject.php line 146 -> $data['colPos' . $element['colPos']][] = $element;

That's probably because I get no values line 218 -> $tmpValue = $cObj->cObjGetSingle($renderObjName, $renderObjConf, $renderObjKey);

Currently the code with a custom element example (using ext mask) looks like the following combined with an answer from https://stackoverflow.com/questions/57505896/typo3-howto-disable-cache-for-specific-content-element-on-a-page

file ts\ContentElements\mask_example.typoscript:

tt_content.mask_example =< lib.contentElementWithHeader tt_content.mask_example { fields { content { fields { header = TEXT header { field = header } title = TEXT title { field = tx_mask_title } } } } }

tmp.mask_example < tt_content.mask_example tt_content.mask_example > tt_content.mask_example = COA_INT tt_content.mask_example { 10 < tmp.mask_example 10 =< lib.contentElementWithHeader }

Can't I wrap the element in your opinion? Or should I modify the code in JsonContentContentObject?