Error with Content Blocks on TYPO3 Version 13
Describe the bug
Trying the TYPO3 Headless API on a new TYPO3 version 13, including the new TYPO3 CMS Content Blocks extension, results in an error when requesting the JSON response.
To Reproduce
Steps to reproduce the behavior:
- Perform a fresh TYPO3 13.2.1 installation.
- Add a new content block with the following command:
typo3/sysext/core/bin/typo3 make:content-block --content-type="content-element" --vendor="my-vendor" --name="my-first-content-element" --title="My shiny new Content Element" --extension="my-extension" - Add the content block as content on a new page.
- Try to load the JSON response.
- See error.
Expected behavior
A JSON response with the newly added content based on the content blocks.
Screenshots
TYPO3 version and TYPO3 Headless version
- TYPO3: 13.2.1
- TYPO3 Headless API: 4.3.2
- TYPO3 CMS Content Blocks: 0.8.0
Additional context
We have been using your headless plugin for a while and would love to have support for TYPO3 version 13 when requesting new content blocks.
Hi @stattmal I have this on roadmap for new major version of our extension, but for I have to wait for final API in core to start adapting it for ext:headless
but feel free @stattmal to send PR
howto get headless running with TYPO3 13? I set up a new composer based TYPO3 13.2.1 - downloaded the last master from headless and changed the dependencies to TYPO3 13.2. So I could install headless but the backend results in 500 Error. @tmotyl is there a release plan for headless for TYPO3 13.2 ?
@cehret you can test now headless with v13 on branch t3v13 (based on v4.4 with added v13 support) see more at https://github.com/TYPO3-Headless/headless/pull/778
I still get this with TYPO3 v13.4.0 and headless 4.5.0.
In JSON, I only have
content: "Oops, an error occurred! Request: d6adf10b3e734",
And in logfile warnings:
Exception: PHP Warning: Trying to access array offset on null in /var/www/html/app/vendor/friendsoftypo3/headless/Classes/ContentObject/JsonContentContentObject.php line 186, in file /var/www/html/app/vendor/typo3/cms-core/Classes/Error/ErrorHandler.php:141
Hi @carsten-wilhelm most probably, with release v4.5.0 we added support for v13, content block extension is not supported at the moment.
Hi @carsten-wilhelm most probably, with release
v4.5.0we added support forv13, content block extension is not supported at the moment.
Any plans for supporting the content block extension?
@cehret Im using content blocks without any issues. I got into one recently but I got it fixed for now. Here was my solution: #801
I also got a Typoscript generator, which generates the Typoscript file for the config.yaml using a command. With my setup you only need to write the config file. Let me know if you want me to share it.
I disabled colPos grouping.
Good news: error has disappeared.
Bad news: I know why - the content block I created is not part of JSON, instead I only see a "null" value. This is the root cause of the initial error, since there is no colPos in null (obviously) and grouping just fails.
Not sure if I did something wrong with the content block or why it is not appearing in JSON at all.
Hi @carsten-wilhelm because, it is not fault of ext:headless per se, but contentblocks. They are not designed to work with headless out-of-box, they are designed for working with fluid templates, and also have different philosophy and approach to handle certain things. AFAIK, contentblocks try to avoid TypoScript as much as possible, in contrast we depend on it, because our implementation is based on TypoScripts' content objects.
To work with ext:headless we need layer to handle of content blocks in headless context. I see that, we have two possible ways to handle it (I have some PoCs, but not finished) one is fix TypoScript generation, second is to create extra data processing of content blocks for headless (but it is not perfect also)
Hi @twoldanski I opened a ticket in the content-blocks issues as well - the response was that this is based on TYPO3 Core (doesn't sound like they will do changes to content-blocks), see https://github.com/FriendsOfTYPO3/content-blocks/issues/348#issuecomment-2660205141
But: I am not the first one to encounter that and found an extension that seems to provide the data processing. At least in my minimal prrof of concept, it works as expected. https://extensions.typo3.org/package/netzbewegung/nb-headless-content-blocks
@carsten-wilhelm Exactly, content blocks are not designed to support headless approach, we need to add support. I saw this extension, this is implementation of one of my approaches (I saw they had same idea), but it still need to handle more things, to be honest I see some nice possible features in this approach, but on the other hand in most cases it will be an overkill doing this way, so still thinking about best approach to handle content blocks in headless context.